From 38ae98a8a93be55d0130b69f63d681be4b1acef6 Mon Sep 17 00:00:00 2001 From: Hao Wu Date: Mon, 14 Oct 2019 23:36:21 +0800 Subject: [PATCH] add loading progress --- public/index.html | 35 ++++++++++++++++++++--------------- src/main.js | 8 ++++++++ 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/public/index.html b/public/index.html index ac0192a..5a0dbe0 100644 --- a/public/index.html +++ b/public/index.html @@ -1,17 +1,22 @@ - - - - - - vue-manage-system - - - -
- - - + + + + + + + vue-manage-system + + + + + + +
+ + + + \ No newline at end of file diff --git a/src/main.js b/src/main.js index 666b6e6..1c7a0f9 100644 --- a/src/main.js +++ b/src/main.js @@ -22,8 +22,11 @@ const i18n = new VueI18n({ //使用钩子函数对路由进行权限跳转 router.beforeEach((to, from, next) => { + NProgress.start() + document.title = `${to.meta.title} | vue-manage-system`; const role = localStorage.getItem('ms_username'); + if (!role && to.path !== '/login') { next('/login'); } else if (to.meta.permission) { @@ -41,6 +44,11 @@ router.beforeEach((to, from, next) => { } }); +router.afterEach((_to, _from) => { + // Complete the animation of the route progress bar. + NProgress.done() +}) + new Vue({ router, i18n,