修复路由懒加载报错问题

This commit is contained in:
RuoYi 2020-04-21 14:48:34 +08:00
parent aae1825697
commit da5c1328be
2 changed files with 10 additions and 10 deletions

View File

@ -33,23 +33,23 @@ export const constantRoutes = [
children: [ children: [
{ {
path: '/redirect/:path(.*)', path: '/redirect/:path(.*)',
component: () => import('@/views/redirect') component: (resolve) => require(['@/views/redirect'], resolve)
} }
] ]
}, },
{ {
path: '/login', path: '/login',
component: () => import('@/views/login'), component: (resolve) => require(['@/views/login'], resolve),
hidden: true hidden: true
}, },
{ {
path: '/404', path: '/404',
component: () => import('@/views/error/404'), component: (resolve) => require(['@/views/error/404'], resolve),
hidden: true hidden: true
}, },
{ {
path: '/401', path: '/401',
component: () => import('@/views/error/401'), component: (resolve) => require(['@/views/error/401'], resolve),
hidden: true hidden: true
}, },
{ {
@ -59,7 +59,7 @@ export const constantRoutes = [
children: [ children: [
{ {
path: 'index', path: 'index',
component: () => import('@/views/index'), component: (resolve) => require(['@/views/index'], resolve),
name: '首页', name: '首页',
meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true } meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true }
} }
@ -73,7 +73,7 @@ export const constantRoutes = [
children: [ children: [
{ {
path: 'profile', path: 'profile',
component: () => import('@/views/system/user/profile/index'), component: (resolve) => require(['@/views/system/user/profile/index'], resolve),
name: 'Profile', name: 'Profile',
meta: { title: '个人中心', icon: 'user' } meta: { title: '个人中心', icon: 'user' }
} }
@ -86,7 +86,7 @@ export const constantRoutes = [
children: [ children: [
{ {
path: 'type/data/:dictId(\\d+)', path: 'type/data/:dictId(\\d+)',
component: () => import('@/views/system/dict/data'), component: (resolve) => require(['@/views/system/dict/data'], resolve),
name: 'Data', name: 'Data',
meta: { title: '字典数据', icon: '' } meta: { title: '字典数据', icon: '' }
} }
@ -99,7 +99,7 @@ export const constantRoutes = [
children: [ children: [
{ {
path: 'log', path: 'log',
component: () => import('@/views/monitor/job/log'), component: (resolve) => require(['@/views/monitor/job/log'], resolve),
name: 'JobLog', name: 'JobLog',
meta: { title: '调度日志' } meta: { title: '调度日志' }
} }
@ -112,7 +112,7 @@ export const constantRoutes = [
children: [ children: [
{ {
path: 'edit', path: 'edit',
component: () => import('@/views/tool/gen/editTable'), component: (resolve) => require(['@/views/tool/gen/editTable'], resolve),
name: 'GenEdit', name: 'GenEdit',
meta: { title: '修改生成配置' } meta: { title: '修改生成配置' }
} }

View File

@ -48,7 +48,7 @@ function filterAsyncRouter(asyncRouterMap) {
} }
export const loadView = (view) => { // 路由懒加载 export const loadView = (view) => { // 路由懒加载
return () => import(`@/views/${view}`) return (resolve) => require([`@/views/${view}`], resolve)
} }
export default permission export default permission