問題願意:依賴包中vue-router出現問題(猜測為版本問題);
解決方法:在項目目錄下運行
npm i vue-router@3.0 -S
這條指令就可以解決了。(更換版本)
或者在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) }
參考來源:https://blog.csdn.net/weixin_43202608/article/details/98884620
以上。
第二種方法未測試,使用第一種方法后問題就已經得到解決了。