From 4edd953dfa175bec434aacaa721b4463169e7c89 Mon Sep 17 00:00:00 2001 From: Kuitos Date: Fri, 19 Mar 2021 18:14:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E6=97=B6=E8=B7=AF=E7=94=B1=E4=B8=8D=E6=94=AF=E6=8C=81=E5=B5=8C?= =?UTF-8?q?=E5=A5=97=E6=A0=B9=E8=B7=AF=E7=94=B1=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin-qiankun/src/master/masterRuntimePlugin.ts.tpl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/plugin-qiankun/src/master/masterRuntimePlugin.ts.tpl b/packages/plugin-qiankun/src/master/masterRuntimePlugin.ts.tpl index 5216d7475..8aa5561e3 100644 --- a/packages/plugin-qiankun/src/master/masterRuntimePlugin.ts.tpl +++ b/packages/plugin-qiankun/src/master/masterRuntimePlugin.ts.tpl @@ -80,10 +80,12 @@ export function patchRoutes(opts: { routes: IRouteProps[] }) { const getRootRoutes = (routes: IRouteProps[]) => { const rootRoute = routes.find(route => route.path === '/'); if (rootRoute) { - if (!rootRoute.routes) { - rootRoute.routes = []; + // 如果根路由是叶子节点,则直接返回其父节点 + if (!rootRoute.routes?.length) { + return routes; } - return rootRoute.routes; + + return getRootRoutes(rootRoute.routes); } return routes;