描述
element-ui多次点击导航(多次push同一个路由),会报错:

解决办法,有2种
- 在
use router之前加入如下代码
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
- 不使用
router模式,在select中加判断
handleSelect(key, keyPath) {
if (key === this.$route.path) {
return;
}
//一些处理
}
参考:
关于element-ui navMenu不选中问题










