#
luxiaotao1123
2024-09-13 4757020896b56a3aa29b85b71fd64a5c43dadb51
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}
                        />
                    );
                }
            }
        });
    };