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

[2.0.0-rc2] Can't get $refs correctly #3455

Closed
dalphyx opened this issue Aug 16, 2016 · 9 comments
Closed

[2.0.0-rc2] Can't get $refs correctly #3455

dalphyx opened this issue Aug 16, 2016 · 9 comments

Comments

@dalphyx
Copy link

dalphyx commented Aug 16, 2016

Vue.js version

2.0 rc2

Reproduction Link

https://jsfiddle.net/1khxsgue/

Steps to reproduce

Just click run button, open console can find the error Cannot read property 'hello' of undefined

What is Expected?

The same code with 2.0 rc-1 https://jsfiddle.net/y35ot0du/ run without any error. We can access key testA inthis.$refs when components mounted hook is called .

@miljan-aleksic
Copy link

@dalphyx, seems to me is behaving as expected. There is a v-if directive set to false which alters the component execution. At the moment of mounted the test component is not available.

@LinusBorg
Copy link
Member

LinusBorg commented Aug 16, 2016

The fact that it does not work in -rc.2 anymore probably has to do with this:

Fixed

Fixed vdom patch errors on components with empty root (e.g. when root has v-if or transition)

238f65d

@yyx990803 Is that a bug ?

@miljan-aleksic
Copy link

@LinusBorg, if using v-if in a root node is forbidden, shouldn't it warn about when doing such?

@LinusBorg
Copy link
Member

Already deleted that comment, that was not entirely correct.

@ije
Copy link

ije commented Aug 17, 2016

great! this bug wasted my a few hours to change the refs logic >.<

@TomKaltz
Copy link

I'm having this issue on 2.4.4.

https://jsfiddle.net/TomKaltz/8q6e5tp5/

@yyx990803
Copy link
Member

@TomKaltz please open a separate issue, thanks.

@dalphyx
Copy link
Author

dalphyx commented Sep 19, 2017

Maybe this is the same issue with #6632

@MrMitch
Copy link

MrMitch commented Jun 12, 2018

@TomKaltz I'va having a very similar issue, did you manage to solve your issue ? If so, how ? If not, what did you end-up doing to acheive what you were going for ?

@LinusBorg LinusBorg reopened this Jun 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants