解决:Avoided redundant navigation to current location: “/xxx“.
最近做一个项目遇到的问题:vue-router.esm.js:1710Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location: "/".点击同一个路由操作,控制台会报错。这是Vue Router的一个预防措施,用来避免不必要的DOM更新,从而提高应用的性能。
·
最近做一个项目遇到的问题:vue-router.esm.js:1710Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location: "/".点击同一个路由操作,控制台会报错

这是Vue Router的一个预防措施,用来避免不必要的DOM更新,从而提高应用的性能。
在router>index.js文件中添加以下代码即可:
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
还是不会的,看如下图:

最后:各位大佬动动你们宝贵的手指,送上点赞加收藏,支持一下小编,蟹蟹~
更多推荐




所有评论(0)