vue路由重复:报错Avoided redundant navigation to current location: “/home”

在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)
}

或者

const originalReplace = VueRouter.prototype.replace;
Router.prototype.replace = function replace(location) {
  return originalReplace.call(this, location).catch(err => err);
};

来源:https://blog.csdn.net/weixin_48828067/article/details/109031358

原文地址:https://www.cnblogs.com/brillant/p/15622663.html