AI智能
改变未来

Error: Avoided redundant navigation to current location ElementUI导航栏重复点击报错

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);};
赞(0) 打赏
未经允许不得转载:爱站程序员基地 » Error: Avoided redundant navigation to current location ElementUI导航栏重复点击报错