Error: Avoided redundant navigation to current location: ElementUI导航栏重复点菜单报错的解决办法:
报错如下:
解决方法:
打开文件中的路由文件,(router/index.js)
import Vue from \"vue\";import VueRouter from \"vue-router\";Vue.use(VueRouter);// 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题const originalPush = VueRouter.prototype.push;VueRouter.prototype.push = function push(location) {return originalPush.call(this, location).catch(err => err)};
如果还是修改了push还是报错,可以尝试这个replace
const originalReplace = VueRouter.prototype.replace;VueRouter.prototype.replace = function replace(location) {return originalReplace.call(this, location).catch(err => err);};