🚸 监听窗口尺寸变化重新计算高度

This commit is contained in:
BTMuli
2025-12-08 23:19:31 +08:00
parent a44bf0f5ba
commit 20a58c3032

View File

@@ -93,6 +93,7 @@
</div>
</template>
<script lang="ts" setup>
import { getCurrentWindow } from "@tauri-apps/api/window";
import { computed, nextTick, onMounted, ref, shallowRef, useTemplateRef, watch } from "vue";
import GroDataLine, { type GroDataLineProps } from "./gro-data-line.vue";
@@ -105,6 +106,7 @@ type GachaDataViewProps = {
};
const props = defineProps<GachaDataViewProps>();
const curWin = getCurrentWindow();
// Template refs for dynamic height calculation
const groDvBoxEl = useTemplateRef<HTMLElement>("groDvBoxRef");
@@ -163,6 +165,11 @@ watch(
},
);
curWin.onResized(async () => {
await nextTick();
calculateHeights();
});
function loadData(): void {
title.value = getTitle();
const tempData = props.dataVal;