|
|
@ -2,16 +2,13 @@ import type { Router } from 'vue-router'; |
|
|
|
|
|
|
|
|
import NProgress from 'nprogress'; |
|
|
import NProgress from 'nprogress'; |
|
|
import 'nprogress/nprogress.css'; |
|
|
import 'nprogress/nprogress.css'; |
|
|
import { getIsOpenTab } from '/@/utils/helper/routeHelper'; |
|
|
|
|
|
|
|
|
|
|
|
export function createProgressGuard(router: Router) { |
|
|
export function createProgressGuard(router: Router) { |
|
|
// NProgress.inc(0.1);
|
|
|
// NProgress.inc(0.1);
|
|
|
// NProgress.configure({ easing: 'ease', speed: 200, showSpinner: false });
|
|
|
// NProgress.configure({ easing: 'ease', speed: 200, showSpinner: false });
|
|
|
|
|
|
|
|
|
router.beforeEach(async (to) => { |
|
|
router.beforeEach(async (to) => { |
|
|
const isOpen = getIsOpenTab(to.path); |
|
|
!to.meta.inTab && NProgress.start(); |
|
|
to.meta.inTab = isOpen; |
|
|
|
|
|
!isOpen && NProgress.start(); |
|
|
|
|
|
return true; |
|
|
return true; |
|
|
}); |
|
|
}); |
|
|
router.afterEach(async (to) => { |
|
|
router.afterEach(async (to) => { |
|
|
|