Skip to content

Commit

Permalink
Menu: fix router NavigationDuplicated error when using vue-router@^3.…
Browse files Browse the repository at this point in the history
…1.0 (#17269)

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

* Better fix

* comment

* fix
  • Loading branch information
iamkun authored and island205 committed Oct 31, 2019
1 parent d15b778 commit df3562d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/menu/src/menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
});
}
},
Expand Down

0 comments on commit df3562d

Please sign in to comment.