Infinity x Infinity
useWindowSize
Reactive window size
Usage
import { useWindowSize } from '@vueuse/core'
const { width, height } = useWindowSize()
Component
<UseWindowSize v-slot="{ width, height }">
Width: {{ width }}
Height: {{ height }}
</UseWindowSize>
Type Declarations
export interface WindowSizeOptions extends ConfigurableWindow {
initialWidth?: number
initialHeight?: number
}
/**
* Reactive window size.
*
* @see https://vueuse.org/useWindowSize
* @param options
*/
export declare function useWindowSize({
window,
initialWidth,
initialHeight,
}?: WindowSizeOptions): {
width: Ref<number>
height: Ref<number>
}
export declare type UseWindowSizeReturn = ReturnType<typeof useWindowSize>