Category | Elements |
---|---|
Export Size | 964 B |
Last Changed | 2 weeks ago |
Reactive window size
import { useWindowSize } from '@vueuse/core' const { width, height } = useWindowSize()
This function also provides a renderless component version via the
@vueuse/components
package. Learn more about the usage.
<UseWindowSize v-slot="{ width, height }"> Width: {{ width }} Height: {{ height }} </UseWindowSize>
export interface UseWindowSizeOptions extends ConfigurableWindow { initialWidth?: number initialHeight?: number /** * Listen to window `orientationchange` event * * @default true */ listenOrientation?: boolean /** * Whether the scrollbar should be included in the width and height * @default true */ includeScrollbar?: boolean } /** * Reactive window size. * * @see https://vueuse.org/useWindowSize * @param options */ export declare function useWindowSize(options?: UseWindowSizeOptions): { width: Ref<number> height: Ref<number> } export type UseWindowSizeReturn = ReturnType<typeof useWindowSize>
© 2019-present Anthony Fu
Licensed under the MIT License.
https://vueuse.org/core/useWindowSize/