jiangchengfeiyi-Web/src/App.vue
2025-02-05 19:31:00 +08:00

47 lines
989 B
Vue

<template>
<el-config-provider :locale="zhCn">
<RouterView v-if="isRouterActive"></RouterView>
</el-config-provider>
</template>
<script setup lang="ts">
// 引入组件刷新功能
import { provide , nextTick , ref , onMounted } from 'vue'
import { ElConfigProvider } from 'element-plus'
import router from './router';
import zhCn from 'element-plus/es/locale/lang/zh-cn' //引入ElemenetPlus中文
import myAxios from './api/myAxios';
const isRouterActive = ref(true)
provide('reload', () => { //页面刷新
isRouterActive.value = false
nextTick(() => {
isRouterActive.value = true
})
})
onMounted(()=>{
checkLoginState()
})
const checkLoginState = async ()=>{ //监测登陆状态
const res = await myAxios.get('/user/get/login')
console.log(res)
if(res.data.code != 1) {
router.push('/')
}
}
</script>
<style scoped>
html{
padding:0;
margin: 0;
}
body{
padding: 0;
margin: 0;
overflow: hidden;
width: 100%;
height: 100%;
}
</style>