这个不可描述的问题是:在使用ElementUI时点击同一个路由,页面报错。
错误代码如下:
element-ui.common.js?ccbf:3339 NavigationDuplicated {_
name: "NavigationDuplicated",
name: "NavigationDuplicated",
message: "Navigating to current location ("/users") is not allowed",
stack: "Error↵ at new NavigationDuplicated (webpack-int…e_modules/element-ui/lib/mixins/emitter.js:29:22)"}
问题描述出来就好办了,查询后修改router/index.js代码,增加:
const originalPush = Router.prototype.push
Router.prototype.push = function push (location) {
return originalPush.call(this, location).catch(err => err)
}
搞掂