Переглянути джерело

修复版本差异导致的懒加载报错问题

RuoYi 4 роки тому
батько
коміт
43f1681f51
2 змінених файлів з 14 додано та 13 видалено
  1. 2 1
      ruoyi-ui/package.json
  2. 12 12
      ruoyi-ui/src/router/index.js

+ 2 - 1
ruoyi-ui/package.json

@@ -55,8 +55,8 @@
55
     "vue": "2.6.12",
55
     "vue": "2.6.12",
56
     "vue-count-to": "1.0.13",
56
     "vue-count-to": "1.0.13",
57
     "vue-cropper": "0.5.5",
57
     "vue-cropper": "0.5.5",
58
-    "vue-router": "3.4.9",
59
     "vue-meta": "2.4.0",
58
     "vue-meta": "2.4.0",
59
+    "vue-router": "3.4.9",
60
     "vuedraggable": "2.24.3",
60
     "vuedraggable": "2.24.3",
61
     "vuex": "3.6.0"
61
     "vuex": "3.6.0"
62
   },
62
   },
@@ -65,6 +65,7 @@
65
     "@vue/cli-plugin-eslint": "4.4.6",
65
     "@vue/cli-plugin-eslint": "4.4.6",
66
     "@vue/cli-service": "4.4.6",
66
     "@vue/cli-service": "4.4.6",
67
     "babel-eslint": "10.1.0",
67
     "babel-eslint": "10.1.0",
68
+    "babel-plugin-dynamic-import-node": "2.3.3",
68
     "chalk": "4.1.0",
69
     "chalk": "4.1.0",
69
     "connect": "3.6.6",
70
     "connect": "3.6.6",
70
     "eslint": "7.15.0",
71
     "eslint": "7.15.0",

+ 12 - 12
ruoyi-ui/src/router/index.js

@@ -35,28 +35,28 @@ export const constantRoutes = [
35
     children: [
35
     children: [
36
       {
36
       {
37
         path: '/redirect/:path(.*)',
37
         path: '/redirect/:path(.*)',
38
-        component: (resolve) => require(['@/views/redirect'], resolve)
38
+        component: () => import('@/views/redirect')
39
       }
39
       }
40
     ]
40
     ]
41
   },
41
   },
42
   {
42
   {
43
     path: '/login',
43
     path: '/login',
44
-    component: (resolve) => require(['@/views/login'], resolve),
44
+    component: () => import('@/views/login'),
45
     hidden: true
45
     hidden: true
46
   },
46
   },
47
   {
47
   {
48
     path: '/register',
48
     path: '/register',
49
-    component: (resolve) => require(['@/views/register'], resolve),
49
+    component: () => import('@/views/register'),
50
     hidden: true
50
     hidden: true
51
   },
51
   },
52
   {
52
   {
53
     path: '/404',
53
     path: '/404',
54
-    component: (resolve) => require(['@/views/error/404'], resolve),
54
+    component: () => import('@/views/error/404'),
55
     hidden: true
55
     hidden: true
56
   },
56
   },
57
   {
57
   {
58
     path: '/401',
58
     path: '/401',
59
-    component: (resolve) => require(['@/views/error/401'], resolve),
59
+    component: () => import('@/views/error/401'),
60
     hidden: true
60
     hidden: true
61
   },
61
   },
62
   {
62
   {
@@ -66,7 +66,7 @@ export const constantRoutes = [
66
     children: [
66
     children: [
67
       {
67
       {
68
         path: 'index',
68
         path: 'index',
69
-        component: (resolve) => require(['@/views/index'], resolve),
69
+        component: () => import('@/views/index'),
70
         name: 'Index',
70
         name: 'Index',
71
         meta: { title: '首页', icon: 'dashboard', affix: true }
71
         meta: { title: '首页', icon: 'dashboard', affix: true }
72
       }
72
       }
@@ -80,7 +80,7 @@ export const constantRoutes = [
80
     children: [
80
     children: [
81
       {
81
       {
82
         path: 'profile',
82
         path: 'profile',
83
-        component: (resolve) => require(['@/views/system/user/profile/index'], resolve),
83
+        component: () => import('@/views/system/user/profile/index'),
84
         name: 'Profile',
84
         name: 'Profile',
85
         meta: { title: '个人中心', icon: 'user' }
85
         meta: { title: '个人中心', icon: 'user' }
86
       }
86
       }
@@ -93,7 +93,7 @@ export const constantRoutes = [
93
     children: [
93
     children: [
94
       {
94
       {
95
         path: 'role/:userId(\\d+)',
95
         path: 'role/:userId(\\d+)',
96
-        component: (resolve) => require(['@/views/system/user/authRole'], resolve),
96
+        component: () => import('@/views/system/user/authRole'),
97
         name: 'AuthRole',
97
         name: 'AuthRole',
98
         meta: { title: '分配角色', activeMenu: '/system/user' }
98
         meta: { title: '分配角色', activeMenu: '/system/user' }
99
       }
99
       }
@@ -106,7 +106,7 @@ export const constantRoutes = [
106
     children: [
106
     children: [
107
       {
107
       {
108
         path: 'user/:roleId(\\d+)',
108
         path: 'user/:roleId(\\d+)',
109
-        component: (resolve) => require(['@/views/system/role/authUser'], resolve),
109
+        component: () => import('@/views/system/role/authUser'),
110
         name: 'AuthUser',
110
         name: 'AuthUser',
111
         meta: { title: '分配用户', activeMenu: '/system/role' }
111
         meta: { title: '分配用户', activeMenu: '/system/role' }
112
       }
112
       }
@@ -119,7 +119,7 @@ export const constantRoutes = [
119
     children: [
119
     children: [
120
       {
120
       {
121
         path: 'index/:dictId(\\d+)',
121
         path: 'index/:dictId(\\d+)',
122
-        component: (resolve) => require(['@/views/system/dict/data'], resolve),
122
+        component: () => import('@/views/system/dict/data'),
123
         name: 'Data',
123
         name: 'Data',
124
         meta: { title: '字典数据', activeMenu: '/system/dict' }
124
         meta: { title: '字典数据', activeMenu: '/system/dict' }
125
       }
125
       }
@@ -132,7 +132,7 @@ export const constantRoutes = [
132
     children: [
132
     children: [
133
       {
133
       {
134
         path: 'index',
134
         path: 'index',
135
-        component: (resolve) => require(['@/views/monitor/job/log'], resolve),
135
+        component: () => import('@/views/monitor/job/log'),
136
         name: 'JobLog',
136
         name: 'JobLog',
137
         meta: { title: '调度日志', activeMenu: '/monitor/job' }
137
         meta: { title: '调度日志', activeMenu: '/monitor/job' }
138
       }
138
       }
@@ -145,7 +145,7 @@ export const constantRoutes = [
145
     children: [
145
     children: [
146
       {
146
       {
147
         path: 'index',
147
         path: 'index',
148
-        component: (resolve) => require(['@/views/tool/gen/editTable'], resolve),
148
+        component: () => import('@/views/tool/gen/editTable'),
149
         name: 'GenEdit',
149
         name: 'GenEdit',
150
         meta: { title: '修改生成配置', activeMenu: '/tool/gen' }
150
         meta: { title: '修改生成配置', activeMenu: '/tool/gen' }
151
       }
151
       }