點擊同一個路由的時候就會報這個錯,解決辦法本人親測有效兩種:
第一種
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里面就好了
