소스 검색

🎈 perf:优化路由目录判断

preschooler 8 달 전
부모
커밋
e0bc260fc1
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      src/utils/routerHelper.ts

+ 1 - 1
src/utils/routerHelper.ts

@@ -120,7 +120,7 @@ export const generateRoute = (routes: AppCustomRouteRecordRaw[]): AppRouteRecord
       data.children = [childrenData]
     } else {
       // 目录
-      if (route.children) {
+      if (route.children?.length) {
         data.component = Layout
         data.redirect = getRedirect(route.path, route.children)
         // 外链