Blame view

src/router/guard/progressGuard.ts 472 Bytes
陈文彬 authored
1
2
3
4
5
6
import type { Router } from 'vue-router';

import NProgress from 'nprogress';
import 'nprogress/nprogress.css';

export function createProgressGuard(router: Router) {
7
8
  // NProgress.inc(0.1);
  // NProgress.configure({ easing: 'ease', speed: 200, showSpinner: false });
9
10
  router.beforeEach(async (to) => {
11
    !to.meta.inTab && NProgress.start();
陈文彬 authored
12
13
    return true;
  });
vben authored
14
15
16
  router.afterEach(async (to) => {
    !to.meta.inTab && NProgress.done();
陈文彬 authored
17
18
19
    return true;
  });
}