出现 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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM