foreign-admin-ui/src/App.vue

37 lines
810 B
Vue

<template>
<div class="app-container">
<TopLoading ref="topLoadingRef" />
<KeepAlive>
<router-view></router-view>
</KeepAlive>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import TopLoading from '@/components/common/TopLoading.vue'
import { useTabsStore } from '@/stores/modules/tabs'
const tabsStore = useTabsStore()
const topLoadingRef = ref<InstanceType<typeof TopLoading>>()
onMounted(() => {
// 将 TopLoading 实例挂载到 window 上,供 api 模块调用
// @ts-ignore
window.__topLoading__ = topLoadingRef.value
// 检查并恢复标签页状态
tabsStore.validateAndRecoverTabs()
})
</script>
<style scoped lang="scss">
.app-container {
width: 100%;
height: 100vh;
overflow: hidden;
position: relative;
}
</style>