Files
Aida_Purchaser_Front/src/App.vue

63 lines
1.5 KiB
Vue
Raw Normal View History

2026-04-20 11:21:21 +08:00
<template>
<main-header />
2026-04-21 16:23:32 +08:00
<div class="view" ref="viewRef" :style="viewStyle"><RouteCache /></div>
2026-04-21 15:57:59 +08:00
<login-dialog />
2026-04-20 11:21:21 +08:00
<div id="loading" v-if="loading" v-loading="true"></div>
</template>
<script setup lang="ts">
2026-04-21 16:17:21 +08:00
import { computed, onMounted, ref, onBeforeUnmount } from 'vue'
2026-04-20 11:21:21 +08:00
import RouteCache from '@/components/RouteCache.vue'
import MainHeader from '@/views/main-header.vue'
2026-04-21 15:57:59 +08:00
import LoginDialog from '@/views/login/login-dialog.vue'
2026-04-20 11:21:21 +08:00
import { useGlobalStore } from '@/stores'
const globalStore = useGlobalStore()
const loading = computed(() => globalStore.state.loading)
2026-04-21 16:17:21 +08:00
const viewRef = ref()
2026-04-21 16:23:32 +08:00
const viewStyle = ref({
'--app-view-width': '',
'--app-view-height': ''
})
2026-04-21 16:17:21 +08:00
const observer = new ResizeObserver((entries) => {
const { width, height } = entries[0].contentRect
2026-04-21 16:23:32 +08:00
viewStyle.value['--app-view-width'] = width + 'px'
viewStyle.value['--app-view-height'] = height + 'px'
2026-04-21 16:17:21 +08:00
})
onMounted(() => {
observer.observe(viewRef.value)
})
onBeforeUnmount(() => {
observer.disconnect()
})
2026-04-20 11:21:21 +08:00
</script>
<style lang="less">
#app {
font-size: 1.6rem;
display: flex;
flex-direction: column;
}
#loading {
position: fixed;
z-index: 999999999;
top: 0;
left: 0;
width: 100%;
height: 100%;
// background-color: rgba(0, 0, 0, 0.3);
// display: flex;
// align-items: center;
// justify-content: center;
}
</style>
<style lang="less" scoped>
2026-04-21 15:57:37 +08:00
* {
--header-height: 8rem;
--footer-height: 7rem;
}
2026-04-20 11:21:21 +08:00
.view {
flex: 1;
overflow: hidden;
}
</style>