vue 跳转页面时报错: NavigationDuplicated: Avoided redundant navigation to current location: "/page"

vue-router路由重复的解决方法:

  在router文件夹下面的index.js中加上下面几句代码:

  

    import VueRouter from 'vue-router'
 

    const originalPush = VueRouter.prototype.push

    VueRouter.prototype.push = function push(location) {
      return originalPush.call(this, location).catch(err => err)
    }
 
 
posted @ 2022-08-30 17:46  搬砖的苦行僧  阅读(142)  评论(0编辑  收藏  举报