Vue - 项目中报错Error: Avoided redundant navigation to current location: “/xxx“.的解决方案
在一个vue项目中重复跳转到同一个路由地址时报错!
报错显示路由重复,对功能没有影响。
解决方法
在入口文件下添加代码:
// 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}