vue重复点击路由报错问题解决

问题描述:vue-router.esm.js?8c4f:1958 Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location: “/ups”;/ups是路由相对路径
解决方法:
1.重新安装vue-router依赖包:npm i [email protected] -S
2.在main.js写入(在引用import VueRouter from 'vue-router’的地方使用)
// 解决重复点击导航路由报错(VueRouter要对应)
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err);
}

你可能感兴趣的:(vue)