Element-ui 重複點擊同一個路由 會報錯:NavigationDuplicated {_name: “NavigationDuplicated”, name: “NavigationDuplicated”}
解決辦法:
在router/index.js裏重寫Router.prototype.push
import Router from 'vue-router'
//需要添加的代碼
const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
};