@twotwoba/vv-cli
Version:
Easily create Vite + React19/Vue3 web/h5/mini-program/chrome-extension projects.
17 lines (13 loc) • 335 B
text/typescript
import type { Router } from 'vue-router'
import { LoadingBar } from '@varlet/ui'
export const createPageLoadingGuard = (router: Router) => {
router.beforeEach(() => {
LoadingBar.start()
})
router.afterEach(() => {
LoadingBar.finish()
})
router.onError(() => {
LoadingBar.error()
})
}