From 70a6873ea9ab0cb9cac09745e979af739b2df44f Mon Sep 17 00:00:00 2001 From: toesbieya <1647775459@qq.com> Date: Sat, 20 Jun 2020 18:45:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E9=A6=96=E5=B1=8F=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vue/public/index.html | 23 ++++++++++++++++++++++- vue/src/router/constant/index.js | 5 +++-- vue/src/router/constant/modules/app.js | 12 ++++++++---- 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/vue/public/index.html b/vue/public/index.html index 20bfdf1..9ab8168 100644 --- a/vue/public/index.html +++ b/vue/public/index.html @@ -10,9 +10,30 @@ <%= webpackConfig.name %> + -
+
+
+ +

资源加载中......

+
+
diff --git a/vue/src/router/constant/index.js b/vue/src/router/constant/index.js index fab42aa..72f0ddc 100644 --- a/vue/src/router/constant/index.js +++ b/vue/src/router/constant/index.js @@ -3,6 +3,7 @@ * constant/modules下的所有route都会加上noAuth:true */ import Layout from '@/layout' +import {lazyLoadView} from '@/router/util' const modulesFiles = require.context('./modules', false, /\.js$/) const modules = modulesFiles.keys().reduce((modules, modulePath) => { @@ -21,7 +22,7 @@ const routes = [ children: [ { path: 'index', - component: () => import('@/views/index'), + component: () => lazyLoadView(import('@/views/index')), name: 'index', meta: {title: '首页', affix: true, icon: 'home'} } @@ -35,7 +36,7 @@ const routes = [ { path: 'index', name: 'userCenter', - component: () => import('@/views/userCenter'), + component: () => lazyLoadView(import('@/views/userCenter')), meta: {title: '个人中心', noCache: true, icon: 'user'}, } ], diff --git a/vue/src/router/constant/modules/app.js b/vue/src/router/constant/modules/app.js index bf6fba2..b3dd890 100644 --- a/vue/src/router/constant/modules/app.js +++ b/vue/src/router/constant/modules/app.js @@ -1,5 +1,9 @@ /*路由表:系统页面*/ import Layout from '@/layout' +import Redirect from '@/views/app/redirect' +import Login from '@/views/app/login' +import Page404 from '@/views/app/404' +import Page403 from '@/views/app/403' const router = [ { @@ -8,22 +12,22 @@ const router = [ children: [ { path: '/redirect/:path(.*)', - component: () => import('@/views/app/redirect') + component: Redirect } ] }, { path: '/login', alias: '/register', - component: () => import('@/views/app/login') + component: Login }, { path: '/404', - component: () => import('@/views/app/404') + component: Page404 }, { path: '/403', - component: () => import('@/views/app/403') + component: Page403 } ]