mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-03-26 05:39:45 +08:00
🚸 监听窗口尺寸变化重新计算高度
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user