Vue点击同一个路由会报错:Avoided redundant navigation to current location
解决方法:在路由守卫中添加如下代码
const originalPush = router.__proto__.push
router.__proto__.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
ps:
1. 此项目使用的是VueRouter,这里偷了个懒直接写了router.__proto__,可以写VueRouter.prototype
2. router = new VueRouter()