| | |
| | | ], |
| | | }, |
| | | { |
| | | path: '/home', |
| | | name: 'home', |
| | | component: './home', |
| | | }, |
| | | { |
| | | path: '*', |
| | | layout: false, |
| | | component: './404', |
| | |
| | | break; |
| | | } |
| | | } |
| | | addMapMenu(remoteMenu); |
| | | |
| | | const rootMenu = { routes: [] } |
| | | addHomeMenu(remoteMenu); |
| | | addUserSettingMenu(remoteMenu); |
| | | patchRouteItems(proLayout, remoteMenu); |
| | | patchRouteItems(rootMenu, remoteMenu); |
| | | console.log(rootMenu); |
| | | |
| | | 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); |
| | | } else { |
| | | // parent |
| | |
| | | path: "/home", |
| | | component: "/home", |
| | | icon: createIcon('HomeOutlined') |
| | | }) |
| | | } |
| | | |
| | | function addMapMenu(remoteMenu) { |
| | | remoteMenu.unshift({ |
| | | name: "地图监控", |
| | | path: "/map", |
| | | component: "/map", |
| | | icon: createIcon('HeatMapOutlined') |
| | | }) |
| | | } |
| | | |