路由从import改为require

prod
wj 2 years ago
parent be1d164387
commit da785d4026

@ -37,28 +37,28 @@ export const constantRoutes = [
children: [
{
path: '/redirect/:path(.*)',
component: () => import('@/views/redirect')
component: (resolve) => require([`@/views/redirect`],resolve)
}
]
},
{
path: '/login',
component: () => import('@/views/myLogin'),
component: (resolve) => require([`@/views/myLogin`],resolve),
hidden: true
},
{
path: '/register',
component: () => import('@/views/register'),
component: (resolve) => require([`@/views/register`],resolve),
hidden: true
},
{
path: '/404',
component: () => import('@/views/error/404'),
component: (resolve) => require([`@/views/error/404`],resolve),
hidden: true
},
{
path: '/401',
component: () => import('@/views/error/401'),
component: (resolve) => require([`@/views/error/401`],resolve),
hidden: true
},
{
@ -68,7 +68,7 @@ export const constantRoutes = [
children: [
{
path: 'index',
component: () => import('@/views/index'),
component: (resolve) => require([`@/views/index`],resolve),
name: 'Index',
meta: { title: '首页', icon: 'dashboard', affix: true }
}
@ -82,7 +82,7 @@ export const constantRoutes = [
children: [
{
path: 'profile',
component: () => import('@/views/system/user/profile/index'),
component: (resolve) => require([`@/views/system/user/profile/index`],resolve),
name: 'Profile',
meta: { title: '个人中心', icon: 'user' }
}
@ -100,7 +100,7 @@ export const dynamicRoutes = [
children: [
{
path: 'role/:userId(\\d+)',
component: () => import('@/views/system/user/authRole'),
component: (resolve) => require([`@/views/system/user/authRole`],resolve),
name: 'AuthRole',
meta: { title: '分配角色', activeMenu: '/system/user' }
}
@ -114,7 +114,7 @@ export const dynamicRoutes = [
children: [
{
path: 'user/:roleId(\\d+)',
component: () => import('@/views/system/role/authUser'),
component: (resolve) => require([`@/views/system/role/authUser`],resolve),
name: 'AuthUser',
meta: { title: '分配用户', activeMenu: '/system/role' }
}
@ -128,7 +128,7 @@ export const dynamicRoutes = [
children: [
{
path: 'index/:dictId(\\d+)',
component: () => import('@/views/system/dict/data'),
component: (resolve) => require([`@/views/system/dict/data`],resolve),
name: 'Data',
meta: { title: '字典数据', activeMenu: '/system/dict' }
}
@ -142,7 +142,7 @@ export const dynamicRoutes = [
children: [
{
path: 'index',
component: () => import('@/views/system/oss/config'),
component: (resolve) => require([`@/views/system/oss/config`],resolve),
name: 'OssConfig',
meta: { title: '配置管理', activeMenu: '/system/oss' }
}
@ -156,7 +156,7 @@ export const dynamicRoutes = [
children: [
{
path: 'index/:tableId(\\d+)',
component: () => import('@/views/tool/gen/editTable'),
component: (resolve) => require([`@/views/tool/gen/editTable`],resolve),
name: 'GenEdit',
meta: { title: '修改生成配置', activeMenu: '/tool/gen' }
}

@ -126,7 +126,8 @@ export const loadView = (view) => {
return (resolve) => require([`@/views/${view}`], resolve)
} else {
// 使用 import 实现生产环境的路由懒加载
return () => import(`@/views/${view}`)
// return () => import(`@/views/${view}`)
return (resolve) => require([`@/views/${view}`], resolve)
}
}

Loading…
Cancel
Save