Files
Aida_Purchaser_Front/src/App.vue
李志鹏 b9be27ab85 aaa
2026-05-21 11:36:14 +08:00

72 lines
1.7 KiB
Vue

<template>
<main-header />
<div class="view" ref="viewRef" :style="viewStyle"><RouteCache /></div>
<login-dialog />
<div id="loading" v-if="loading" v-loading="true"></div>
<shopping-drawer />
</template>
<script setup lang="ts">
import { computed, onMounted, ref, onBeforeUnmount } from 'vue'
import RouteCache from '@/components/RouteCache.vue'
import MainHeader from '@/views/main-header.vue'
import LoginDialog from '@/views/login/login-dialog.vue'
import { useGlobalStore } from '@/stores'
import ShoppingDrawer from '@/views/shopping-drawer.vue'
const globalStore = useGlobalStore()
const loading = computed(() => globalStore.state.loading)
globalStore.setLoading(false)
const viewRef = ref()
const viewStyle = ref({
'--app-view-width': '',
'--app-view-height': ''
})
const observer = new ResizeObserver((entries) => {
const { width, height } = entries[0].contentRect
viewStyle.value['--app-view-width'] = width + 'px'
viewStyle.value['--app-view-height'] = height + 'px'
})
onMounted(() => {
observer.observe(viewRef.value)
})
onBeforeUnmount(() => {
observer.disconnect()
})
window['onClickPrivacy'] = () => {
const e = window.event || event
e.stopPropagation()
e.preventDefault()
console.log('点击了隐私政策')
}
</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>
* {
--header-height: 8rem;
--footer-height: 7rem;
}
.view {
flex: 1;
overflow: hidden;
}
</style>