-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ref doesn't work properly with v-for together #1166
Comments
Vue 3 no longer has special behavior for |
Actually, we may need to detect non composition api usage for backwards compat. Or we need an RFC to officially deprecate this (I never considered it good practice anyway, and it creates a TON of complexity when used inside nested |
Gotcha. My quick idea is introducing another |
It's worth noting that the current v3 docs do explicitly note support for
https://v3.vuejs.org/guide/component-template-refs.html If this should be changed to reflect the current status I'm happy to PR. |
Is there any migration strategy for about this? |
@yyx990803 We actually can do the same thing we recommend for the composition with the options API: Example: https://jsfiddle.net/Linusborg/xjcbyw2f/1/ This should in theory also allow people to come up with a strategy for nested v-for situations (which, I agree, are a complexity nightmare) @syuilo That should work as a migration strategy I think. @vuejs/docs Can we add this example to the migration guide for Options-API users? |
Im not sure to understand why you say it can create complexity. Isn't the goal of this feature to be an alternative to document.getElementById and document.getElementByClassName without breaking the component logic (document.getElementById can access DOM on other components but ref cant)? Isn't |
We actually changed our minds about his and reintroduced the old behavior quite recently. Currently there still is a bug (#5447) but we will patch that ver soon. So I'll close this old issue about this. |
Version
3.0.0-beta.10
Reproduction link
https://codesandbox.io/s/goofy-yalow-d0x6e?file=/src/App.vue
Steps to reproduce
What is expected?
print an array of all spans
What is actually happening?
the last span
https://vuejs.org/v2/api/#ref
The text was updated successfully, but these errors were encountered: