From 9ff2e55e89f816fb3e6fbe24c4cb6204c7d629b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Mon, 29 Nov 2021 22:35:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20Loading=20=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/app.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/static/app.js b/static/app.js index 5af2aa676..9c4fc07c1 100644 --- a/static/app.js +++ b/static/app.js @@ -39,7 +39,11 @@ if (router.hasRoute(name)) { next(); } else { + let loading = ElementPlus.ElLoading.service({ + lock: true, text: 'Loading', background: 'rgba(0, 0, 0, 0.3)', + }); router.addRoute({name: name, path: to.fullPath, component: loadVueFile(to.fullPath)}); + setTimeout(() => loading.close(), 1000); next({name: name}); } }); @@ -49,7 +53,7 @@ console.log('Route: ', to.name); let name = to.fullPath.replace(/[.\/]+/g, '_'); if (router.hasRoute(name)) { - console.log('clear', name) + console.log('Clear: ', name) router.removeRoute(name) } }); @@ -61,7 +65,9 @@ // } // }); - const app = Vue.createApp(Vue.defineAsyncComponent(() => loadVue('./static/template/layout.vue'))); + const app = Vue.createApp(Vue.defineAsyncComponent(function () { + return loadVue('./static/template/layout.vue'); + })); // 全局字体文件 // const icons = await loadVue("https://unpkg.com/@element-plus/icons@0.0.11/lib/index.js");