Avoided redundant navigation to current location的解决方式

2022-08-06,,,,

在写项目的时候,遇到 Avoided redundant navigation to current location的问题

在网上查的时候,发现大家都说是在菜单栏重复点击的原因,

我的工作场景是,点击菜单栏后,在这个单页面里面点击跳转,【跳转的这个页面没有在菜单栏的地址】,然后我想要返回上个页面,我就又点击了一遍菜单栏,就出现了这个报错,【虽然没什么特别的影响,但是看着红色就感觉不是很爽】

解决方式

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

在这个路径里面添加

添加完的样子

TIP:
若项目太大,实在找不到,可以考虑一个方法,用ctrl+shift+f快捷键,全局搜索Vue.use(Router),

本文地址:https://blog.csdn.net/kikikiuu/article/details/107286826

《Avoided redundant navigation to current location的解决方式.doc》

下载本文的Word格式文档,以方便收藏与打印。