Files
Yi.Admin/Yi.RuoYi.Vue3/src/App.vue

29 lines
652 B
Vue
Raw Normal View History

2023-02-04 18:06:42 +08:00
<template>
<router-view />
</template>
<script setup>
import useSettingsStore from '@/store/modules/settings'
import { handleThemeStyle } from '@/utils/theme'
import useUserStore from '@/store/modules/user'
import { storeToRefs } from 'pinia';
2023-12-11 09:55:12 +08:00
import signalR from '@/utils/signalR'
2023-02-04 18:06:42 +08:00
const {token}=storeToRefs(useUserStore());
2023-12-11 09:55:12 +08:00
onMounted(async () => {
await signalR.init(`main`);
2023-02-04 18:06:42 +08:00
nextTick(() => {
// 初始化主题样式
handleThemeStyle(useSettingsStore().theme)
})
})
//这里还需要监视token的变化重新进行signalr连接
watch(()=>token.value,async (newValue,oldValue)=>{
2023-12-11 09:55:12 +08:00
await signalR.init(`main`);
2023-02-04 18:06:42 +08:00
})
</script>