Vue路由控制台错误NavigationDuplicated {_name: 'NavigationDuplicated'xxx

47 阅读1分钟

Vue路由控制台错误NavigationDuplicated

控制台错误 image.png

解决方法

在mian.js中添加如下代码

 import Router from 'vue-router'
 const routerPush = Router.prototype.push
 Router.prototype.push = function push(location) {
     return routerPush.call(this, location).catch(error=> error)
}