Procházet zdrojové kódy

fix(动态路由): 修复跳转后不显示问题

xieyonghong před 3 roky
rodič
revize
ef80aaf0fe
1 změnil soubory, kde provedl 2 přidání a 2 odebrání
  1. 2 2
      src/app.tsx

+ 2 - 2
src/app.tsx

@@ -210,8 +210,8 @@ export const layout: RunTimeLayoutConfig = ({ initialState }) => {
 
 export function patchRoutes(routes: any) {
   if (extraRoutes && extraRoutes.length) {
-    console.log(getRoutes(extraRoutes));
-    routes.routes[1].routes = [...routes.routes[1].routes, ...getRoutes(extraRoutes)];
+    const basePath = routes.routes.find((_route: any) => _route.path === '/')!;
+    basePath.routes = [...basePath.routes, ...getRoutes(extraRoutes)];
   }
 }