Kaynağa Gözat

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

xieyonghong 3 yıl önce
ebeveyn
işleme
ef80aaf0fe
1 değiştirilmiş dosya ile 2 ekleme ve 2 silme
  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)];
   }
 }