useWindowSize
useWindowSize
リアクティブなウィンドウサイズ
使用法
<script setup lang="ts">
import { useWindowSize } from '@vueuse/core'
const { width, height } = useWindowSize()
</script>
<template>
<div>
Width: {{ width }}
Height: {{ height }}
</div>
</template>
コンポーネントの使用法
<template>
<UseWindowSize v-slot="{ width, height }">
Width: {{ width }}
Height: {{ height }}
</UseWindowSize>
</template>
© 2019–PRESENT Anthony Fu https://github.com/antfu
※このページは Nuxt.js 公式ドキュメントの翻訳ページです。
公式ドキュメントの該当ページはこちら:
#