1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| import React from 'react' import { Router, Switch } from 'dva/router' import SubRoutes from './components/SubRoutes'
const RouteConfig = [ { path: '/', model: [], component: () => import('./pages/IndexPage'), routes: [ { path: '/home', model: [import('./models/home')], component: () => import('./pages/Home'), redirect: true, isAuthority: true, }, { path: '/manage', model: [], component: () => import('./pages/Manage'), isAuthority: true,
} ] } ]
function RouterConfig({ history, app }) { return ( <Router history={history}> <Switch> {RouteConfig.map((route, i) => <SubRoutes {...route} key={i} app={app} /> )} </Switch> </Router> ); }
export default RouterConfig;
|