From 25ee732f47fce720da216dce590a309225af8eb1 Mon Sep 17 00:00:00 2001
From: zhangchen <1652267879@qq.com>
Date: 星期四, 24 七月 2025 16:54:29 +0800
Subject: [PATCH] ID1625-宽高变化时重新渲染
---
src/views/mobile/bedsideAuxiliaryScreen/components/ScheduledTask.vue | 0
src/views/mobile/bedsideAuxiliaryScreen/index.vue | 10 ++++++----
src/composables/useWindowSize.ts | 21 +++++++++++++++++++++
3 files changed, 27 insertions(+), 4 deletions(-)
diff --git a/src/composables/useWindowSize.ts b/src/composables/useWindowSize.ts
new file mode 100644
index 0000000..87a4238
--- /dev/null
+++ b/src/composables/useWindowSize.ts
@@ -0,0 +1,21 @@
+import { ref, onMounted, onUnmounted } from 'vue';
+
+export function useWindowSize() {
+ const width = ref(window.innerWidth);
+ const height = ref(window.innerHeight);
+
+ const updateSize = () => {
+ width.value = window.innerWidth;
+ height.value = window.innerHeight;
+ };
+
+ onMounted(() => {
+ window.addEventListener('resize', updateSize);
+ });
+
+ onUnmounted(() => {
+ window.removeEventListener('resize', updateSize);
+ });
+
+ return { width, height };
+}
diff --git a/src/views/mobile/bedsideAuxiliaryScreen/components/ScheduledTask.vue b/src/views/mobile/bedsideAuxiliaryScreen/components/ScheduledTask.vue
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/views/mobile/bedsideAuxiliaryScreen/components/ScheduledTask.vue
diff --git a/src/views/mobile/bedsideAuxiliaryScreen/index.vue b/src/views/mobile/bedsideAuxiliaryScreen/index.vue
index c66c775..ab6c350 100644
--- a/src/views/mobile/bedsideAuxiliaryScreen/index.vue
+++ b/src/views/mobile/bedsideAuxiliaryScreen/index.vue
@@ -16,6 +16,7 @@
import { useBedsideAuxiliaryScreenStore } from "@/store/bedsideAuxiliaryScreen";
import { EPageType } from '@/store/type/bedsideAuxiliaryScreen.type';
import { getAvailableHeightByClass } from '@/utils/utils';
+import { useWindowSize } from '@/composables/useWindowSize';
// 未排班时的组件
const UnplannedSchedule = defineAsyncComponent(() => import('./pages/UnplannedSchedule.vue'));
// 未签到时的组件
@@ -27,6 +28,7 @@
const bedsideAuxiliaryScreenStore = useBedsideAuxiliaryScreenStore();
const cotentHeight = ref(0);
+const { width, height } = useWindowSize();
const backgroundColor = computed(() => {
@@ -59,10 +61,10 @@
return name;
});
-watch(
- () => bedsideAuxiliaryScreenStore.deviceCode,
- (newVal: string) => {}
-);
+watch([width, height], () => {
+ cotentHeight.value = getAvailableHeightByClass('content-position')
+});
+
onMounted(() => {
if (bedsideAuxiliaryScreenStore.deviceCode) {
--
Gitblit v1.8.0