VUE 路由重复报错问题
在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)
}//解决路由重复报错问题