add loading progress
parent
838a03086e
commit
38ae98a8a9
|
@ -1,17 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
|
||||
<link rel="stylesheet" href="//at.alicdn.com/t/font_830376_qzecyukz0s.css">
|
||||
<title>vue-manage-system</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>We're sorry but vms doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
|
||||
<link rel="stylesheet" href="//at.alicdn.com/t/font_830376_qzecyukz0s.css">
|
||||
<title>vue-manage-system</title>
|
||||
<link href="https://unpkg.com/nprogress@0.2.0/nprogress.css" rel="stylesheet" />
|
||||
<script src="https://unpkg.com/nprogress@0.2.0/nprogress.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>We're sorry but vms doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue