diff --git a/packages/core/client/src/route-switch/antd/admin-layout/index.tsx b/packages/core/client/src/route-switch/antd/admin-layout/index.tsx index ddbf8a266f..a1c35ba28a 100644 --- a/packages/core/client/src/route-switch/antd/admin-layout/index.tsx +++ b/packages/core/client/src/route-switch/antd/admin-layout/index.tsx @@ -756,6 +756,19 @@ const MenuDesignerButton: FC<{ testId: string }> = (props) => { }); }; +const MenuTitleWithIcon: FC<{ icon: any; title: string }> = (props) => { + if (props.icon) { + return ( +
+ + {props.title} +
+ ); + } + + return props.title; +}; + function convertRoutesToLayout( routes: NocoBaseDesktopRoute[], { designable, parentRoute, isMobile, t, depth = 0 }: any, @@ -775,9 +788,11 @@ function convertRoutesToLayout( }; const result: any[] = routes.map((item) => { + const name = depth > 1 ? : t(item.title); // ProLayout 组件不显示第二级菜单的 icon,所以这里自己实现 + if (item.type === NocoBaseDesktopRouteType.link) { return { - name: t(item.title), + name, icon: item.icon ? : null, path: '/', hideInMenu: item.hideInMenu, @@ -788,7 +803,7 @@ function convertRoutesToLayout( if (item.type === NocoBaseDesktopRouteType.page) { return { - name: t(item.title), + name, icon: item.icon ? : null, path: `/admin/${item.schemaUid}`, redirect: `/admin/${item.schemaUid}`, @@ -808,7 +823,7 @@ function convertRoutesToLayout( } return { - name: t(item.title), + name, icon: item.icon ? : null, path: `/admin/${item.id}`, redirect: