修改router文件夾下index.js
import Vue from 'vue'
import VueRouter from "vue-router";
// 點擊左側菜單欄中的項,重復點擊時會報錯,解決這個問題
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
Router.prototype.replace = function replace(location) {
return originalPush.call(this, location).catch(err => err)
}