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 will remove unused node and set the refs to undefined #6632

Closed
dalphyx opened this issue Sep 18, 2017 · 3 comments · Fixed by #6718
Closed

Vue will remove unused node and set the refs to undefined #6632

dalphyx opened this issue Sep 18, 2017 · 3 comments · Fixed by #6718

Comments

@dalphyx
Copy link

dalphyx commented Sep 18, 2017

Version

2.4.4

Reproduction link

https://jsfiddle.net/gloxing/Ltjyjjba/

Steps to reproduce

click button twice, the refs of components will be undefined

What is expected?

the topProgress component show again

What is actually happening?

the refs of component will be undefined


The behaviour is normal in Vue 2.4.2.

@posva
Copy link
Member

posva commented Sep 18, 2017

This is actually related to your lib: https://github.com/dalphyx/vue-top-progress/blob/master/src/top-progress.vue#L7
I think that because you're using a v-if, it gets stripped off and doesn't exist (transition being an abstract component that doesn't render a tag). Have you tried using a v-show, it should work: https://jsfiddle.net/t5ad6o31/

Another solution would be to wrap your component in a div or span

@posva posva closed this as completed Sep 18, 2017
@dalphyx
Copy link
Author

dalphyx commented Sep 18, 2017

Yeah, v-show should work. But before v2.4.4 both v-show and v-if works well.

@xgqfrms
Copy link

xgqfrms commented Feb 16, 2019

vue refs undefined

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

Successfully merging a pull request may close this issue.

3 participants