美文网首页
路由报错的问题

路由报错的问题

作者: 宏_4491 | 来源:发表于2020-09-06 15:52 被阅读0次

    在VUE中路由遇到Error: Avoided redundant navigation to current location:报错显示是路由重复

    image.png

    解决:router文件夹下面的index.js中加上下面几句代码,搞定

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

    相关文章

      网友评论

          本文标题:路由报错的问题

          本文链接:https://www.haomeiwen.com/subject/baucektx.html