主题
useWindowSize
反应式窗口大小
¥Reactive window size
示例
用法
¥Usage
vue
<script setup lang="ts">
import { useWindowSize } from '@vueuse/core'
const { width, height } = useWindowSize()
</script>
<template>
<div>
Width: {{ width }}
Height: {{ height }}
</div>
</template>
组件用法
¥Component Usage
vue
<template>
<UseWindowSize v-slot="{ width, height }">
Width: {{ width }}
Height: {{ height }}
</UseWindowSize>
</template>