ナビゲーションバーのvue-routerバージョン3.0以降の繰り返しメニューエラーの問題を解決するAvoided redundant navigation to current location
3183 ワード
import Vue from 'vue';
import Router from 'vue-router';
Vue.use(Router);
// ElementUI vue-router 3.0
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
pushを変更しても有効でない場合は、次のようなreplaceメソッドを試します.
const originalReplace = Router.prototype.replace;
Router.prototype.replace = function replace(location) {
return originalReplace.call(this, location).catch(err => err);
};