From 64aaf44b6b2948631ebd0d9840d51e5e31ae5479 Mon Sep 17 00:00:00 2001
From: zhangchen <1652267879@qq.com>
Date: 星期五, 25 七月 2025 01:44:25 +0800
Subject: [PATCH] Merge branch 'ID1825-床旁副屏改版' into test
---
src/composables/useWindowSize.ts | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 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 };
+}
--
Gitblit v1.8.0