版权声明
- 本文原创作者:谷哥的小弟
- 作者博客地址:http://blog.youkuaiyun.com/lfdfhl
问题描述
在使用Vue路由切换时报错:Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location: “/register”.
解决方案
// 处理多次切换相同路由的异常
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
};