出现 Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation 问题

主要原因是Vue 重复点击相同路由造成的:

解决方案:

      第一种:在 router 文件夹下里面的文件index.js里面找到如下位置:

        // src/router/index.js

         Vue.use(Router)

        const router = new Router({

             routes

        })

        找到上面位置,在下面增加这段代码即可。

        const VueRouterPush = Router.prototype.push

        Router.prototype.push = function push (to) {

              return VueRouterPush.call(this, to).catch(err => err)

        }

 

 

参考链接:https://blog.csdn.net/qq_36437172/article/details/108269846

posted @ 2020-12-03 16:53  黑暗时代地表人  阅读(7546)  评论(0编辑  收藏  举报