优化首次载入方式

This commit is contained in:
叮叮当
2023-09-19 14:30:54 +08:00
parent e5b836462f
commit 1abdf6d15c
2 changed files with 112 additions and 113 deletions

View File

@@ -28,7 +28,7 @@ app.use(vuetify)
.use(ToastPlugin, {
position: 'bottom-right',
})
.use(VuetifyUseDialog).mount('#app')
.use(VuetifyUseDialog)
// 路由导航守卫
router.beforeEach((to, from, next) => {
@@ -48,11 +48,10 @@ let isFirstApp: Boolean = true
router.afterEach(() => {
doneNProgress()
if (isFirstApp) {
// 标记首次载入完成, 再隐藏loading页面, 让首次载入更加丝滑
// 标记首次载入完成, 再绑定app
isFirstApp = false
const loading_bg = document.getElementById('loading-bg')
if (loading_bg)
// 或许这里需要再多加一点延迟才能改善ios的bug
document.body.removeChild(loading_bg)
setTimeout(() => {
app.mount('#app')
}, 300)
}
})