Skip to content

Commit 5388f04

Browse files
authored
fix: 修复运行时路由不支持嵌套根路由的问题 (#565)
1 parent efa1472 commit 5388f04

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

packages/plugin-qiankun/src/master/masterRuntimePlugin.ts.tpl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,12 @@ export function patchRoutes(opts: { routes: IRouteProps[] }) {
8282
const getRootRoutes = (routes: IRouteProps[]) => {
8383
const rootRoute = routes.find(route => route.path === '/');
8484
if (rootRoute) {
85-
if (!rootRoute.routes) {
86-
rootRoute.routes = [];
85+
// 如果根路由是叶子节点,则直接返回其父节点
86+
if (!rootRoute.routes?.length) {
87+
return routes;
8788
}
88-
return rootRoute.routes;
89+
90+
return getRootRoutes(rootRoute.routes);
8991
}
9092

9193
return routes;

0 commit comments

Comments
 (0)