NavigationDuplicated: Avoided redundant navigation to current location...

VUE 路由重复报错问题
NavigationDuplicated: Avoided redundant navigation to current location...
在router/index.js文件内写
解决方法1:push

import Vue from "vue";
import VueRouter from "vue-router";
Vue.use(VueRouter);

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}//解决路由重复报错问题

解决方法2:replace

import Vue from "vue";
import VueRouter from "vue-router";
Vue.use(VueRouter);

const originalReplace = VueRouter.prototype.replace
VueRouter.prototype.replace = function replace (location) {
  return originalReplace.call(this, location).catch(err => err)
}//解决路由重复报错问题
上一篇:java利用compareTo方法判断两圆大小


下一篇:外卖店优先级