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