From c993b0005df6cccdc8d701a16493eb40fb4f4c73 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 19 九月 2024 17:14:45 +0800
Subject: [PATCH] #
---
zy-acs-flow/src/layout/MyMenu.jsx | 36 ++++++++++++++++++++----------------
1 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/zy-acs-flow/src/layout/MyMenu.jsx b/zy-acs-flow/src/layout/MyMenu.jsx
index b996e97..8d0ff35 100644
--- a/zy-acs-flow/src/layout/MyMenu.jsx
+++ b/zy-acs-flow/src/layout/MyMenu.jsx
@@ -12,12 +12,12 @@
import SubMenu from './SubMenu';
import SettingsIcon from '@mui/icons-material/Settings';
import DashboardIcon from '@mui/icons-material/Dashboard';
-import DehazeIcon from '@mui/icons-material/Dehaze';
+import HorizontalRuleIcon from '@mui/icons-material/HorizontalRule';
import PersonIcon from '@mui/icons-material/Person';
import * as Icons from '@mui/icons-material';
const getIconComponent = (iconStr) => {
- return Icons[iconStr] || DehazeIcon;
+ return Icons[iconStr] || HorizontalRuleIcon;
};
export const MyMenu = ({ dense = false }) => {
@@ -41,7 +41,9 @@
const getIcon = (iconStr) => {
const IconComponent = getIconComponent(iconStr);
- return <IconComponent />;
+ if (IconComponent) {
+ return <IconComponent />;
+ }
};
const generateMenu = (permissions) => {
@@ -60,19 +62,21 @@
</SubMenu>
);
} else {
- return (
- <MenuItemLink
- key={node.id}
- to={node.component} // correspond to Resource.name
- state={{ _scrollToTop: true }}
- // primaryText={translate(`resources.orders.name`, {
- // smart_count: 2,
- // })}
- primaryText={node.name}
- leftIcon={getIcon(node.icon)}
- dense={dense}
- />
- );
+ if (node.component) {
+ return (
+ <MenuItemLink
+ key={node.id}
+ to={node.component} // correspond to Resource.name
+ state={{ _scrollToTop: true }}
+ // primaryText={translate(`resources.orders.name`, {
+ // smart_count: 2,
+ // })}
+ primaryText={node.name}
+ leftIcon={getIcon(node.icon)}
+ dense={dense}
+ />
+ );
+ }
}
});
};
--
Gitblit v1.9.1