ソースを参照

fix: 面包屑

wzyyy 3 年 前
コミット
cdd3c3effd
1 ファイル変更16 行追加2 行削除
  1. 16 2
      src/app.tsx

+ 16 - 2
src/app.tsx

@@ -16,6 +16,7 @@ import { service as MenuService } from '@/pages/system/Menu';
 import getRoutes, { extraRouteArr, getMenus, handleRoutes, saveMenusCache } from '@/utils/menu';
 import getRoutes, { extraRouteArr, getMenus, handleRoutes, saveMenusCache } from '@/utils/menu';
 import { AIcon } from '@/components';
 import { AIcon } from '@/components';
 import React from 'react';
 import React from 'react';
+import { getMenuPathByCode } from '@/utils/menu';
 
 
 const isDev = process.env.NODE_ENV === 'development';
 const isDev = process.env.NODE_ENV === 'development';
 const loginPath = '/user/login';
 const loginPath = '/user/login';
@@ -236,8 +237,21 @@ export const layout: RunTimeLayoutConfig = ({ initialState }) => {
       // content: initialState?.currentUser?.name,
       // content: initialState?.currentUser?.name,
     },
     },
     itemRender: (route, _, routes) => {
     itemRender: (route, _, routes) => {
-      const chilck = routes.indexOf(route) > 1;
-      return chilck && route.path !== '/iot/rule-engine/Alarm' ? (
+      console.log(route);
+      const isToParentUrl = getMenuPathByCode('notice');
+      const chilck = routes.indexOf(route) !== 0;
+      const goto = routes.some((item) => {
+        if (!route.path.includes('iot')) {
+          return routes.indexOf(route) <= 1;
+        } else {
+          if (route.path.includes('notice')) {
+            return item.path.indexOf(isToParentUrl) > -1;
+          } else {
+            return routes.indexOf(route) > 1;
+          }
+        }
+      });
+      return chilck && goto && route.path !== '/iot/rule-engine/Alarm' ? (
         <Link to={route.path}>{route.breadcrumbName}</Link>
         <Link to={route.path}>{route.breadcrumbName}</Link>
       ) : (
       ) : (
         <span>{route.breadcrumbName}</span>
         <span>{route.breadcrumbName}</span>