This commit is contained in:
jxxghp
2023-09-19 17:24:05 +08:00
parent 048f2abd87
commit 4f625291a5

View File

@@ -10,9 +10,6 @@ globalTheme.name.value = localStorage.getItem('theme') || 'light'
// 提示框
const $toast = useToast()
// 是否加载完成
const isLoaded = ref(false)
// SSE持续接收消息
function startSSEMessager() {
const token = store.state.auth.token
@@ -33,42 +30,14 @@ function startSSEMessager() {
}
}
// 是否LG大屏幕
const isLargeScreen = ref(false)
// 检测屏幕大小
function checkScreenSize() {
const screenWidth = window.innerWidth
isLargeScreen.value = screenWidth >= 1024
}
// 页面加载时,加载当前用户数据
onBeforeMount(async () => {
checkScreenSize()
startSSEMessager()
// 如果是小屏幕1秒后才显示界面
if (!isLargeScreen.value) {
setTimeout(() => {
isLoaded.value = true
}, 500)
}
else {
isLoaded.value = true
}
})
</script>
<template>
<div
v-if="!isLoaded"
class="mt-12 w-full text-center text-gray-500 text-sm flex flex-col items-center"
>
<VProgressCircular
size="48"
indeterminate
color="primary"
/>
</div>
<VApp v-show="isLoaded">
<VApp>
<RouterView />
</VApp>
</template>