This commit is contained in:
Lexcubia 2025-04-21 11:39:35 +08:00
parent 403d6499b1
commit 3b842e0b48
2 changed files with 16 additions and 9 deletions

View File

@ -2,16 +2,22 @@
import { RouterView } from "vue-router";
import { onMounted } from 'vue'
onMounted(() => {
window.addEventListener("resize", ()=>{
heightTemp.value = (window.innerHeight)+"px";
document.getElementById("app").style.height = heightTemp.value;
});
window.addEventListener("DOMContentLoaded", ()=>{
heightTemp.value = (window.innerHeight)+"px";
document.getElementById("app").style.height = heightTemp.value;
});
})
})
onMounted(() => {
//1%1vh
let vh = window.innerHeight * 0.01
// vh
document.documentElement.style.setProperty('--vh', `${vh}px`)
// resize 1vh
window.addEventListener('resize', () => {
//
let vh = window.innerHeight * 0.01
console.log(vh);
document.documentElement.style.setProperty('--vh', `${vh}px`)
})
})
</script>
<template>

View File

@ -16,6 +16,7 @@ import Sidebar from '../components/Sidebar.vue'
.main-layout {
display: flex;
height: 100vh;
height: calc(var(--vh, 1vh) * 100);
/* min-width: 640px; */
overflow: hidden; /* 防止内部滚动影响布局 */
}