浏览代码

解决处理顶级非目录路由的组件名称逻辑缺失的问题

shizhong 1 年之前
父节点
当前提交
361e4fadda
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      src/utils/routerHelper.ts

+ 4 - 1
src/utils/routerHelper.ts

@@ -93,7 +93,10 @@ export const generateRoute = (routes: AppCustomRouteRecordRaw[]): AppRouteRecord
       meta.alwaysShow = true
       const childrenData: AppRouteRecordRaw = {
         path: '',
-        name: toCamelCase(route.path, true),
+        name:
+          route.componentName && route.componentName.length > 0
+            ? route.componentName
+            : toCamelCase(route.path, true),
         redirect: route.redirect,
         meta: meta
       }