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里面就好了


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM