vue项目中报错信息如下:
当vue项目中遇到 NavigationDuplicated: Avoided redundant navigation to current location报错信息,报错显示是路由重复,对项目没有影响,但是红色的错误信息会让人觉得不太舒服。
解决方法: 在引入vueRouter的文件中添加下面的代码即可:
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}