vue-router 3.1.5报错:vue-router.esm.js?8c4f:2089 Uncaught (in promise)

点击同一个路由的时候就会报这个错,解决办法本人亲测有效两种:

 

第一种

 

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里面就好了
posted @ 2020-03-26 15:45  洛晨随风  阅读(1331)  评论(0编辑  收藏  举报