Skip to content
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

vue@3.2.25 The ref attribute generated by vbind string template has changed #5585

Closed
fullmooooon opened this issue Mar 15, 2022 · 6 comments
Closed

Comments

@fullmooooon
Copy link

fullmooooon commented Mar 15, 2022

Version

3.2.25 or 3.2.33

Reproduction link

Vue SFC Playground Demo

Steps to reproduce

choose Vue Version: 3.2.25 or Version: v3.2.33
click testRef button, see devtools get log

<input>
[input]
[input]

choose Vue Version: 3.2.24
click testRef button, see devtools get log

<input>
<input ref_for="true" placeholder="mInput0">
<input ref_for="true" placeholder="mInput1">

What is expected?

this.$refs["mInput0"] get dom .
not be wrapped by array

What is actually happening?

Vue Version >= 3.2.25
this.$refs["mInput0"] get a [Array]

Vue Version <= 3.2.24
this.$refs["mInput0"] get dom

Originally by 'this.$refs["mInput0"]' the component object that can be accessed. The outer layer is wrapped with an array. I
must use 'this.$refs["mInput0"][0]' to access

@lidlanca
Copy link
Contributor

likely related to
#5118

@posva
Copy link
Member

posva commented Mar 16, 2022

Your reproduction is not minimal, please read and follow https://new-issue.vuejs.org/?repo=vuejs/vue-next#why-repro when reporting a bug. Most bugs should be reproducible with the SFC Playground.

@posva posva closed this as completed Mar 16, 2022
@fullmooooon
Copy link
Author

Your reproduction is not minimal, please read and follow https://new-issue.vuejs.org/?repo=vuejs/vue-next#why-repro when reporting a bug. Most bugs should be reproducible with the SFC Playground.

Really sorry,edited.
There is still this problem on version 3.2.33, so I want to reopen issue

@fullmooooon
Copy link
Author

likely related to #5118

likely related to #5118

I edited demo.
Is your repair already in the latest version 3.2.33? it doesn't seem to have any effect on me.
It does seem to be a similar problem.

@fullmooooon fullmooooon changed the title vue@3.2.25 The ref attribute generated by vbind has changed vue@3.2.25 The ref attribute generated by vbind string template has changed Apr 18, 2022
@kospl
Copy link

kospl commented May 25, 2022

@posva can this be reopened? There is clear reproduction link now in first post.

Since Vue 3 has changed how refs work inside loops (old doc link in Russian): https://v3.ru.vuejs.org/ru/guide/migration/array-refs.html#frontmatter-title
I don't see this mentioned in https://v3-migration.vuejs.org/migration-build.html#fully-compatible - there is no doc link for COMPILER_V_FOR_REF.

@yyx990803
Copy link
Member

We decided to revert to Vue 2 behavior since the Vue 3 behavior was undesirable in most cases. The compat entry was also removed.

@github-actions github-actions bot locked and limited conversation to collaborators Sep 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants