This commit is contained in:
wangzenghua 2025-04-24 08:11:40 +01:00
parent c96914ca17
commit 61ea29df36

View File

@ -1,24 +1,68 @@
<template> <template>
<section class="base-laytout"> <section
class="base-laytout"
:style="{ width: `${state.style.width}px`, height: `${state.style.height}px`, transform: `${state.style.transform}` }"
>
<custom-scroll-title class="base-laytout-header" /> <custom-scroll-title class="base-laytout-header" />
<section class="base-laytout-main"> <section class="base-laytout-main">
<router-view /> <router-view />
</section> </section>
</section> </section>
</template> </template>
<script setup>
import { onMounted, reactive } from 'vue';
const state = reactive({
style: {
width: '1920',
height: '1080',
transform: 'scaleY(1) scaleX(1) translate(-50%, -50%)',
},
scale: {},
});
const getScale = () => {
const w = window.innerWidth / state.style.width;
const h = window.innerHeight / state.style.height;
return { x: w, y: h };
};
const setScale = () => {
state.scale = getScale();
state.style.transform = 'scaleY(' + state.scale.y + ') scaleX(' + state.scale.x + ') translate(-50%, -50%)';
};
onMounted(() => {
setScale();
window.onresize = () => {
setScale();
};
});
</script>
<style lang="scss" scoped> <style lang="scss" scoped>
.base-laytout { .base-laytout {
@include flex-column();
position: fixed;
z-index: 100;
transform-origin: 0 0;
left: 50%;
top: 50%;
transition: 0.3s;
user-select: none;
box-sizing: border-box; box-sizing: border-box;
width: 100vw; width: 100%;
height: 100vh; height: 100;
background: background:
url('../assets/images/basic/containerBG.png') no-repeat center 100%, url('../assets/images/basic/containerBG.png') no-repeat center 100%,
url('@/assets/images/basic/containerBotBG.png') no-repeat bottom center; url('@/assets/images/basic/containerBotBG.png') no-repeat bottom center;
&-header { &-header {
width: 100%;
height: 60px; height: 60px;
margin-bottom: 60px;
} }
&-main { &-main {
height: calc(100vh - 60px); flex: 1;
min-height: calc(100vh - 60px);
} }
} }
</style> </style>