VUE.js項目中控制檯報錯: Uncaught (in promise) NavigationDuplicated解決方法

問題願意:依賴包中vue-router出現問題(猜想爲版本問題);vue

解決方法:在項目目錄下運行vue-router

 npm i vue-router@3.0 -S

這條指令就能夠解決了。(更換版本)npm

或者在main.js中添加如下代碼:測試

import Router from 'vue-router'

const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

 

參考來源:http://www.javashuo.com/article/p-rxywddkn-mz.htmlthis

以上。spa

第二種方法未測試,使用第一種方法後問題就已經獲得解決了。.net

相關文章
相關標籤/搜索