Files
vitesse/src/modules/nprogress.ts
T
2024-12-03 14:00:28 +08:00

15 lines
327 B
TypeScript

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