-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Comments
+1 how to resolve it ? @Hades-li |
mark |
@Hades-li 有解决方案吗? |
@my9074 貌似 vue-router 最近的版本解决了,随着 new Vue 的 app 实例被销毁,相应的监听会销毁 |
@IndexXuan 是 vue3 版本的 router 还是 vue2 版本的? |
升级一下vue-router的版本 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
对于vue的实列可以调用destory函数来销毁。但vue-router并没有提供销毁功能。如果A子项目配置了beforeEach的全局守卫函数,当从A项目切换到B项目时,A项目的路由守卫回调函数依然会被执行,导致全局受到影响。
最好的办法是能在A子项目unmount的时候移除路由监听,但完全没办法去除。
有什么好办法来解决此问题。
The text was updated successfully, but these errors were encountered: