Vue|VUE router 导航重复点击报错的问题解决方案

现象

 

 Avoided redundant navigation to current location:  避免了对当前位置的冗余导航

解决方案

在 route.js 中添加以下代码

//获取原型对象上的push函数
const originalPush = VueRouter.prototype.push VueRouter.prototype.push = function push(location) {
//修改原型对象中的push方法,replace方法就把VueRouter.prototype.push的push换成replace即可 return originalPush.call(this, location).catch(err => err) }

 

posted @ 2021-07-23 10:04  未来可期_Durant  阅读(178)  评论(0编辑  收藏  举报