mirror of
https://github.com/fmhy/edit.git
synced 2025-07-30 07:42:18 +10:00
hello world, again
This commit is contained in:
commit
f479740dd1
133 changed files with 32895 additions and 0 deletions
23
docs/.vitepress/theme/composables/nprogress.ts
Normal file
23
docs/.vitepress/theme/composables/nprogress.ts
Normal 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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue