| | |
| | | break; |
| | | } |
| | | } |
| | | |
| | | const rootMenu = { routes: [], children: [] } |
| | | addHomeMenu(remoteMenu); |
| | | addUserSettingMenu(remoteMenu); |
| | | patchRouteItems(proLayout, remoteMenu); |
| | | patchRouteItems(rootMenu, remoteMenu); |
| | | |
| | | proLayout.children = proLayout.children.concat(rootMenu.routes); |
| | | proLayout.routes = proLayout.routes.concat(rootMenu.routes); |
| | | } |
| | | |
| | | function patchRouteItems(parent, children) { |
| | |
| | | path: menu.path, |
| | | element: <Component />, |
| | | } |
| | | parent.children.push(newRoute); |
| | | parent.routes.push(newRoute); |
| | | parent.children.push(newRoute); |
| | | } else { |
| | | // parent |
| | | const newRoute = { |
| | |
| | | children: [], |
| | | } |
| | | parent.routes.push(newRoute); |
| | | parent.children.push(newRoute); |
| | | if (menu.routes && menu.routes.length > 0) { |
| | | for (const route of menu.routes) { |
| | | patchRouteItems(newRoute, [route]); |
| | |
| | | } |
| | | } |
| | | |
| | | function addHomeMenu(remoteMenu) { |
| | | remoteMenu.unshift({ |
| | | name: "首页", |
| | | path: "/home", |
| | | component: "/home", |
| | | icon: createIcon('HomeOutlined') |
| | | }) |
| | | } |
| | | |
| | | function addUserSettingMenu(remoteMenu) { |
| | | // const settingRoute = { |
| | | // name: "个人设置", |