Uncaught (in promise) Error: Avoided redundant navigation to current location:

vue项目中,重复点击路由会出现如下报错
Uncaught (in promise) Error: Avoided redundant navigation to current location:_第1张图片

解决办法:
在router的配置文件中(router -> index.js)加上:

const originalPush = Router.prototype.push
Router.prototype.push = function push (location) {
  return originalPush.call(this, location).catch(err => err)
}

即可解决
Uncaught (in promise) Error: Avoided redundant navigation to current location:_第2张图片

参考:
https://blog.csdn.net/xiecheng1995/article/details/106497172/?utm_medium=distribute.pc_relevant.none-task-blog-baidujs-1

你可能感兴趣的:(前端)