Files
Yi.Framework/Yi.Bbs.Vue3/src/App.vue
2024-01-17 16:31:01 +08:00

47 lines
1.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup></script>
<template>
<el-config-provider :locale="locale">
<RouterView />
</el-config-provider>
</template>
<script setup>
import signalR from "@/utils/signalR";
import useConfigStore from "@/stores/config";
import { ElConfigProvider } from "element-plus";
import useUserStore from "@/stores/user.js";
import { onMounted,watch,computed } from "vue";
const userStore = useUserStore();
import zhCn from "element-plus/dist/locale/zh-cn.mjs";
const locale = zhCn;
const configStore = useConfigStore();
const token = computed(() => useUserStore().token);
// 判断是否有loading有的话去掉
const loading = document.getElementById("Loading");
if (loading !== null) {
document.body.removeChild(Loading);
}
//加载全局信息
onMounted(async () => {
await configStore.getConfig();
// setInterval(() => {
// console.log("token的值"+tokenValue.value);
// }, 1000); // 1000毫秒即1秒
});
watch(
() => token,
(val,oldValue) => {
//console.log("token发生改变");
if (val) {
signalR.close();
signalR.init(`main`);
}
},
{immediate:true,deep:true}
);
</script>
<style scoped></style>