export const generateRoutes = (menuData: any[]): any[] => {
    const routeMapper = (item: any, isRoot: boolean = false): any => {
        const { path, name, icon, children, parentId, id } = item;
        const route: any = {
            path,
            name,
            icon,
            parentId,
            id,
            children: children ? children.map(child => routeMapper(child)) : [],
        };
        return route;
    };

    return menuData.map(item => routeMapper(item)); // 根菜单项需要设置 isRoot 为 true
};