单应用项目,可以创建很多独立工具类页面 ,不用登录 初始化的页面
zhangchen
2025-09-12 80878eaf15525329cddc3b06659a798b812af7dc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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 };
}