Files
eslint-config/fixtures/vitesse/src/modules/nprogress.ts
2022-11-17 01:27:16 +08:00

15 lines
327 B
TypeScript

import NProgress from 'nprogress'
import { type UserModule } from '~/types'
export const install: UserModule = ({ isClient, router }) => {
if (isClient) {
router.beforeEach((to, from) => {
if (to.path !== from.path)
NProgress.start()
})
router.afterEach(() => {
NProgress.done()
})
}
}