vue 项目报错:ERROR: AVOIDED REDUNDANT NAVIGATION TO CURRENT LOCATION解决方案
// 解决vue-router在3.0版本以上重复点菜单报错问题
第一种方式:
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
如果第一种方式不生效可以把push改为replace
const originalPush = Router.prototype.replace
Router.prototype.replace= function replace(location) {
return originalPush.call(this, location).catch(err => err)
}