点击同一个路由的时候就会报这个错,解决办法本人亲测有效两种:
第一种
this.$router.push('/home',onAbort => { })
通过加回调函数规避
但是路由多的时候显然是太麻烦。
第二种
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
写到route.js里面就好了