feat: reorganize repo

This commit is contained in:
taskylizard 2024-08-03 10:38:06 +00:00
parent 49eb39bc1f
commit 23389c69df
No known key found for this signature in database
GPG key ID: 1820131ED1A24120
107 changed files with 15 additions and 429 deletions

View file

@ -0,0 +1,23 @@
import nprogress, { type NProgress } from 'nprogress'
import type { EnhanceAppContext } from 'vitepress'
export function loadProgress(router: EnhanceAppContext['router']): NProgress {
if (typeof window === 'undefined') return
setTimeout(() => {
nprogress.configure({ showSpinner: false })
const cacheBeforeRouteChange = router.onBeforeRouteChange
const cacheAfterRouteChange = router.onAfterRouteChanged
router.onBeforeRouteChange = (to) => {
nprogress.start()
cacheBeforeRouteChange?.(to)
}
router.onAfterRouteChanged = (to) => {
nprogress.done()
cacheAfterRouteChange?.(to)
}
})
return nprogress
}