Vue中重复点击链接的报错:Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current lo
报错信息如下:
解决方法:
在router中的index.js文件中添加一下代码就可以解决了!
import Router from 'vue-router'
// 解决重复点击链接的报错
const routerPush = Router.prototype.push
Router.prototype.push = function push(location) {
return routerPush.call(this, location).catch(error=> error)
}
原创
2021-05-20 16:18:40 ·
136 阅读 ·
0 评论