Skip to content

useWindowSize

反应式窗口大小

¥Reactive window size

示例

Infinity x Infinity

用法

¥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>