This commit is contained in:
Putoo
2026-04-27 18:29:35 +08:00
parent 3617d497b6
commit 7ee960cfc7
3 changed files with 31 additions and 10 deletions

View File

@@ -8,15 +8,19 @@
<script setup lang="ts">
// 项目根入口文件
// Nuxt4会自动注入无需手动配置
// 全局样式已移至 src/assets/css/style.css 并在 nuxt.config.ts 中全局引用
// 可以在这里进行全局初始化
const appStore = useAppStore()
import { Loading } from 'vant'
const userStore = useUserStore();
const { on, emit } = useEventBus()
//连接signlar
const ConnectSignlar = (clientId: string) => {
console.log(`客户端:${clientId}`);
}
// 初始化应用配置
onMounted(() => {
userStore.setToken("5555","111","222");
// 初始化屏幕尺寸
if (typeof window !== 'undefined') {
appStore.updateScreenSize(window.innerWidth, window.innerHeight)
@@ -34,6 +38,15 @@ onMounted(() => {
appStore.setOnlineStatus(false)
})
}
if (userStore.getUserId != '') {
ConnectSignlar(userStore.getUserId);
}
//监听启动连接signlaR
on<any>('connect', (payload) => {
ConnectSignlar(payload);
})
})
</script>