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

Assign :ref to zero result in missing element in $refs #7669

Closed
Nattapong-sir opened this issue Feb 20, 2018 · 1 comment · Fixed by #7676
Closed

Assign :ref to zero result in missing element in $refs #7669

Nattapong-sir opened this issue Feb 20, 2018 · 1 comment · Fixed by #7676
Labels

Comments

@Nattapong-sir
Copy link

Version

2.5.13

Reproduction link

https://jsfiddle.net/hhu05cd2/18/

Steps to reproduce

Assign any element with ref to 0.
Such as

What is expected?

p exist in $refs

What is actually happening?

p isn't in $refs


Workaround is to put additional char to :ref such as

Now, that p will be in this.$refs.

Reference: https://forum.vuejs.org/t/element-with-ref-0-disappear-from-refs/27925

@sqal
Copy link
Contributor

sqal commented Feb 20, 2018

Looks like a bug. Probably this check should be replaced with if (!isDef(key)) return

@LinusBorg LinusBorg added the bug label Feb 20, 2018
yyx990803 pushed a commit that referenced this issue Feb 21, 2018
prevents missing elements when :ref value is "0"

fix #7669
f2009 pushed a commit to f2009/vue that referenced this issue Jan 25, 2019
prevents missing elements when :ref value is "0"

fix vuejs#7669
aJean pushed a commit to aJean/vue that referenced this issue Aug 19, 2020
prevents missing elements when :ref value is "0"

fix vuejs#7669
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants