import{o as a,a as n,y as t}from"./vue-libs.b44bc779.js";const e={class:"van-doc-markdown-body"},l=t(`

useWindowSize

Intro

Get the viewport width and height of the browser window, and update it automatically when the window size changes.

Usage

Basic Usage

import { watch } from 'vue';
import { useWindowSize } from '@vant/use';

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

    console.log(width.value); // -> width of browser window
    console.log(height.value); // -> height of browser window

    watch([width, height], () => {
      console.log('window resized');
    });
  },
};

API

Type Declarations

function useWindowSize(): {
  width: Ref<number>;
  height: Ref<number>;
};

Return Value

NameDescriptionType
widthThe width of browser windowRef<number>
heightThe height of browser windowRef<number>
`,7),i=[l],r={__name:"use-window-size.en-US",setup(o,{expose:s}){return s({frontmatter:{}}),(c,h)=>(a(),n("div",e,i))}};export{r as default};