Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location: "*************".
![](https://img.haomeiwen.com/i6897582/99409233a8f09c32.png)
解决方案
`在路由的配置文件(index.js)中,导入 VueRouter 的时候,进行全局的处理`
import Vue from 'vue'
import VueRouter from 'vue-router'
// 获取原型对象上的push函数
const originalPush = VueRouter.prototype.push;
// 修改原型对象中的push方法
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
Vue.use(VueRouter)
网友评论