1111
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user