欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Avoided redundant navigation to current location的解决方式

程序员文章站 2022-05-07 19:20:51
在写项目的时候,遇到 Avoided redundant navigation to current location的问题在网上查的时候,发现大家都说是在菜单栏重复点击的原因,我的工作场景是,点击菜单栏后,在这个单页面里面点击跳转,【跳转的这个页面没有在菜单栏的地址】,然后我想要返回上个页面,我就又点击了一遍菜单栏,就出现了这个报错,【虽然没什么特别的影响,但是看着红色就感觉不是很爽】解决方式:const originalPush = Router.prototype.pushRouter.p....

Avoided redundant navigation to current location的解决方式

在写项目的时候,遇到 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)
}

Avoided redundant navigation to current location的解决方式
在这个路径里面添加

Avoided redundant navigation to current location的解决方式
添加完的样子

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

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