Menu: fix router NavigationDuplicated error when using vue-router@^3.1.0 (#17269)

* Menu: fix router NavigationDuplicated error when using vue-router@^3.1.0

* Better fix

* comment

* fix
pull/17926/head
iamkun 2019-10-31 15:03:29 +08:00 committed by Zhi Cun
parent d15b778826
commit df3562d905
1 changed files with 6 additions and 1 deletions

View File

@ -271,7 +271,12 @@
if (this.router && hasIndex) {
this.routeToItem(item, (error) => {
this.activeIndex = oldActiveIndex;
if (error) console.error(error);
if (error) {
// vue-router 3.1.0+ push/replace cause NavigationDuplicated error
// https://github.com/ElemeFE/element/issues/17044
if (error.name === 'NavigationDuplicated') return
console.error(error)
}
});
}
},