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

Error: Avoided redundant navigation to current location: “/XXX“.的问题

程序员文章站 2022-04-10 09:47:14
Error: Avoided redundant navigation to current location: “/XXX”今天用vue的小demo,当我点击事件时,在浏览器上报如下错我,由于对前对不是很了解,一直找不到错在哪点,进过一番百度一下,终于找到了解决的办法,这个错误时由于路由重复,解决办法:在vue项目下的router的index.js上,在代码里的Vue.use(Router)上加上以下几行代码,大功告成:/** * 解决ElementUI导航栏中的vue-router在3.0版本...

Error: Avoided redundant navigation to current location: “/XXX”

今天用vue的小demo,当我点击事件时,在浏览器上报如下错我,由于对前对不是很了解,一直找不到错在哪点,
Error: Avoided redundant navigation to current location: “/XXX“.的问题
进过一番百度一下,终于找到了解决的办法,这个错误时由于路由重复,解决办法:在vue项目下的router的index.js上,在代码里的Vue.use(Router)下面加上以下几行代码,大功告成:

/**
 * 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
 */
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

本文地址:https://blog.csdn.net/m0_45025997/article/details/107252926