fix: 修复挂载路由时使用$loadingBar出错问题

This commit is contained in:
张传龙 2022-03-29 09:28:36 +08:00
parent 437d87f19e
commit 33aaadba60
2 changed files with 4 additions and 4 deletions

View File

@ -13,7 +13,7 @@ async function setupApp() {
await setupRouter(app) await setupRouter(app)
app.mount('#app', true) app.mount('#app')
} }
setupApp() setupApp()

View File

@ -1,15 +1,15 @@
export function createPageLoadingGuard(router) { export function createPageLoadingGuard(router) {
router.beforeEach(() => { router.beforeEach(() => {
$loadingBar.start() window.$loadingBar?.start()
}) })
router.afterEach(() => { router.afterEach(() => {
setTimeout(() => { setTimeout(() => {
$loadingBar.finish() window.$loadingBar?.finish()
}, 200) }, 200)
}) })
router.onError(() => { router.onError(() => {
$loadingBar.error() window.$loadingBar?.error()
}) })
} }