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-router全局守卫无法销毁的困惑 #83

Closed
Hades-li opened this issue Sep 18, 2019 · 6 comments
Closed

关于vue-router全局守卫无法销毁的困惑 #83

Hades-li opened this issue Sep 18, 2019 · 6 comments

Comments

@Hades-li
Copy link

对于vue的实列可以调用destory函数来销毁。但vue-router并没有提供销毁功能。如果A子项目配置了beforeEach的全局守卫函数,当从A项目切换到B项目时,A项目的路由守卫回调函数依然会被执行,导致全局受到影响。
最好的办法是能在A子项目unmount的时候移除路由监听,但完全没办法去除。
有什么好办法来解决此问题。

@IndexXuan
Copy link

+1 how to resolve it ? @Hades-li

@joinwen
Copy link

joinwen commented Mar 30, 2020

mark

@my9074
Copy link

my9074 commented Mar 1, 2021

@Hades-li 有解决方案吗?

@IndexXuan
Copy link

@my9074 貌似 vue-router 最近的版本解决了,随着 new Vue 的 app 实例被销毁,相应的监听会销毁

@my9074
Copy link

my9074 commented Mar 4, 2021

@IndexXuan 是 vue3 版本的 router 还是 vue2 版本的?

@klonhj2015
Copy link

升级一下vue-router的版本
vuejs/vue-router#3172

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

5 participants