diff --git a/src/common/nav.js b/src/common/nav.js index d32fa0d88f4b101ea2e887aebdf74089398f7a73..416ed1c01911b90627cd6168cd84f81d782f71ea 100644 --- a/src/common/nav.js +++ b/src/common/nav.js @@ -4,13 +4,13 @@ import dynamic from 'dva/dynamic'; const dynamicWrapper = (app, models, component) => dynamic({ app, models: () => models.map(m => import(`../models/${m}.js`)), - component: () => component, + component, }); // nav data export const getNavData = app => [ { - component: dynamicWrapper(app, ['user'], import('../layouts/BasicLayout')), + component: dynamicWrapper(app, ['user'], () => import('../layouts/BasicLayout')), layout: 'BasicLayout', name: '首页', // for breadcrumb path: '/', @@ -23,17 +23,17 @@ export const getNavData = app => [ { name: '分析页', path: 'analysis', - component: dynamicWrapper(app, ['chart'], import('../routes/Dashboard/Analysis')), + component: dynamicWrapper(app, ['chart'], () => import('../routes/Dashboard/Analysis')), }, { name: '监控页', path: 'monitor', - component: dynamicWrapper(app, ['monitor'], import('../routes/Dashboard/Monitor')), + component: dynamicWrapper(app, ['monitor'], () => import('../routes/Dashboard/Monitor')), }, { name: '工作台', path: 'workplace', - component: dynamicWrapper(app, ['project', 'activities', 'chart'], import('../routes/Dashboard/Workplace')), + component: dynamicWrapper(app, ['project', 'activities', 'chart'], () => import('../routes/Dashboard/Workplace')), }, ], }, @@ -45,27 +45,27 @@ export const getNavData = app => [ { name: '基础表单', path: 'basic-form', - component: dynamicWrapper(app, ['form'], import('../routes/Forms/BasicForm')), + component: dynamicWrapper(app, ['form'], () => import('../routes/Forms/BasicForm')), }, { name: '分步表单', path: 'step-form', - component: dynamicWrapper(app, ['form'], import('../routes/Forms/StepForm')), + component: dynamicWrapper(app, ['form'], () => import('../routes/Forms/StepForm')), children: [ { path: 'confirm', - component: dynamicWrapper(app, ['form'], import('../routes/Forms/StepForm/Step2')), + component: dynamicWrapper(app, ['form'], () => import('../routes/Forms/StepForm/Step2')), }, { path: 'result', - component: dynamicWrapper(app, ['form'], import('../routes/Forms/StepForm/Step3')), + component: dynamicWrapper(app, ['form'], () => import('../routes/Forms/StepForm/Step3')), }, ], }, { name: '高级表单', path: 'advanced-form', - component: dynamicWrapper(app, ['form'], import('../routes/Forms/AdvancedForm')), + component: dynamicWrapper(app, ['form'], () => import('../routes/Forms/AdvancedForm')), }, ], }, @@ -77,32 +77,32 @@ export const getNavData = app => [ { name: '查询表格', path: 'table-list', - component: dynamicWrapper(app, ['rule'], import('../routes/List/TableList')), + component: dynamicWrapper(app, ['rule'], () => import('../routes/List/TableList')), }, { name: '标准列表', path: 'basic-list', - component: dynamicWrapper(app, ['list'], import('../routes/List/BasicList')), + component: dynamicWrapper(app, ['list'], () => import('../routes/List/BasicList')), }, { name: '卡片列表', path: 'card-list', - component: dynamicWrapper(app, ['list'], import('../routes/List/CardList')), + component: dynamicWrapper(app, ['list'], () => import('../routes/List/CardList')), }, { name: '搜索列表(项目)', path: 'cover-card-list', - component: dynamicWrapper(app, ['list'], import('../routes/List/CoverCardList')), + component: dynamicWrapper(app, ['list'], () => import('../routes/List/CoverCardList')), }, { name: '搜索列表(应用)', path: 'filter-card-list', - component: dynamicWrapper(app, ['list'], import('../routes/List/FilterCardList')), + component: dynamicWrapper(app, ['list'], () => import('../routes/List/FilterCardList')), }, { name: '搜索列表(文章)', path: 'search', - component: dynamicWrapper(app, ['list'], import('../routes/List/SearchList')), + component: dynamicWrapper(app, ['list'], () => import('../routes/List/SearchList')), }, ], }, @@ -114,12 +114,12 @@ export const getNavData = app => [ { name: '基础详情页', path: 'basic', - component: dynamicWrapper(app, ['profile'], import('../routes/Profile/BasicProfile')), + component: dynamicWrapper(app, ['profile'], () => import('../routes/Profile/BasicProfile')), }, { name: '高级详情页', path: 'advanced', - component: dynamicWrapper(app, ['profile'], import('../routes/Profile/AdvancedProfile')), + component: dynamicWrapper(app, ['profile'], () => import('../routes/Profile/AdvancedProfile')), }, ], }, @@ -131,12 +131,12 @@ export const getNavData = app => [ { name: '成功', path: 'success', - component: dynamicWrapper(app, [], import('../routes/Result/Success')), + component: dynamicWrapper(app, [], () => import('../routes/Result/Success')), }, { name: '失败', path: 'fail', - component: dynamicWrapper(app, [], import('../routes/Result/Error')), + component: dynamicWrapper(app, [], () => import('../routes/Result/Error')), }, ], }, @@ -148,24 +148,24 @@ export const getNavData = app => [ { name: '403', path: '403', - component: dynamicWrapper(app, [], import('../routes/Exception/403')), + component: dynamicWrapper(app, [], () => import('../routes/Exception/403')), }, { name: '404', path: '404', - component: dynamicWrapper(app, [], import('../routes/Exception/404')), + component: dynamicWrapper(app, [], () => import('../routes/Exception/404')), }, { name: '500', path: '500', - component: dynamicWrapper(app, [], import('../routes/Exception/500')), + component: dynamicWrapper(app, [], () => import('../routes/Exception/500')), }, ], }, ], }, { - component: dynamicWrapper(app, [], import('../layouts/UserLayout')), + component: dynamicWrapper(app, [], () => import('../layouts/UserLayout')), path: '/user', layout: 'UserLayout', children: [ @@ -177,24 +177,24 @@ export const getNavData = app => [ { name: '登录', path: 'login', - component: dynamicWrapper(app, ['login'], import('../routes/User/Login')), + component: dynamicWrapper(app, ['login'], () => import('../routes/User/Login')), }, { name: '注册', path: 'register', - component: dynamicWrapper(app, ['register'], import('../routes/User/Register')), + component: dynamicWrapper(app, ['register'], () => import('../routes/User/Register')), }, { name: '注册结果', path: 'register-result', - component: dynamicWrapper(app, [], import('../routes/User/RegisterResult')), + component: dynamicWrapper(app, [], () => import('../routes/User/RegisterResult')), }, ], }, ], }, { - component: dynamicWrapper(app, [], import('../layouts/BlankLayout')), + component: dynamicWrapper(app, [], () => import('../layouts/BlankLayout')), layout: 'BlankLayout', children: { name: '使用文档',