Files
directus/app/src/composables/use-window-size
2020-11-09 12:29:01 -05:00
..
2020-07-29 11:24:52 -04:00
2020-07-29 11:24:52 -04:00
2020-07-29 11:24:52 -04:00

useWindowSize

function useWindowSize(options: WindowSizeOptions = { throttle: 100 }): { width: Ref<number>; height: Ref<number>; }

Returns the window's width and height in an object. These values are reactive.

The optional options parameter allows you to set the throttling speed.

Usage

import { defineComponent } from '@vue/composition-api';
import { useWindowSize } from '@/composables/use-window-size/';

export default defineComponent({
	setup(props) {
		const { width, height } = useWindowSize();
	}
});