2.0 rc2
https://jsfiddle.net/1khxsgue/
Just click run button, open console can find the error Cannot read property 'hello' of undefined
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 .
@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.
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)
https://github.com/vuejs/vue/commit/238f65dc71312c9e1b459771ce4373e25af32f10
@yyx990803 Is that a bug ?
@LinusBorg, if using v-if in a root node is forbidden, shouldn't it warn about when doing such?
Already deleted that comment, that was not entirely correct.
great! this bug wasted my a few hours to change the refs logic >.<
I'm having this issue on 2.4.4.
@TomKaltz please open a separate issue, thanks.
Maybe this is the same issue with #6632
@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 ?
Most helpful comment
@dalphyx, seems to me is behaving as expected. There is a
v-ifdirective set to false which alters the component execution. At the moment ofmountedthe test component is not available.