Skip to content

Commit df3562d

Browse files
iamkunisland205
authored andcommitted
Menu: fix router NavigationDuplicated error when using vue-router@^3.1.0 (ElemeFE#17269)
* Menu: fix router NavigationDuplicated error when using vue-router@^3.1.0 * Better fix * comment * fix
1 parent d15b778 commit df3562d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/menu/src/menu.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,12 @@
271271
if (this.router && hasIndex) {
272272
this.routeToItem(item, (error) => {
273273
this.activeIndex = oldActiveIndex;
274-
if (error) console.error(error);
274+
if (error) {
275+
// vue-router 3.1.0+ push/replace cause NavigationDuplicated error
276+
// https://github.com/ElemeFE/element/issues/17044
277+
if (error.name === 'NavigationDuplicated') return
278+
console.error(error)
279+
}
275280
});
276281
}
277282
},

0 commit comments

Comments
 (0)