使用element-ui的子菜单项点击两下出现 NavigationDuplicated {_name: "NavigationDuplicated", 报错

问题:

输入下面代码放在

// router>index.js中添加代码:

,路由文件里面即可解决问题

import Vue from "vue";
import Router from "vue-router";

Vue.use(Router);

// 解决element-ui点击同一个路由报错:NavigationDuplicated
const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err);
};

猜你喜欢

转载自www.cnblogs.com/binky/p/12673224.html