路由同名报错:A route named “XXX,15392445455393“ has been added as a child of a route with the same name
【代码】路由同名报错:A route named “XXX,15392445455393“ has been added as a child of a route with the same name。
·
报错: A route named “首页,1539240033666875393” has been added as a child of a route with the same name. Route names must be unique and a nested route cannot use the same name as an ancestor.
解决方式一:
降低 vue-router 从 4.5.0 到 4.4.5,解决 路由 重复的问题
解决方式二:
this.$router.$avueRouter.formatRoutes(data, true);
Router.$avueRouter.formatRoutes(Store.getters.menuAll, true);
调整为
this.$router.$avueRouter.formatRoutes(data, false);
Router.$avueRouter.formatRoutes(Store.getters.menuAll, false);
true/false这个参数表示是否需要将转换后的路由与现有路由合并。比如,`false`表示替换现有路由,而`true`表示追加。
更多推荐
所有评论(0)