【报错】Uncaught (in promise) Error: Avoided redundant navigation to current location:

vue项目中,重复点击路由会出现如下报错
在这里插入图片描述

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

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

即可解决
在这里插入图片描述

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

猜你喜欢

转载自blog.csdn.net/weixin_42050406/article/details/106501295
今日推荐