/*! For license information please see 9160.b9db01ad.js.LICENSE.txt */ (self.webpackChunk=self.webpackChunk||[]).push([["9160"],{17786:function(n,t,s){"use strict";s.r(t);var e=s("80681");let a=["innerHTML"];t.default={setup:()=>({html:""}),render:()=>((0,e.wg)(),(0,e.iD)("div",{class:"van-doc-markdown-body",innerHTML:'
Get the size of an element and its position relative to the viewport, equivalent to Element.getBoundingClientRect.
\n<div ref="root" />\n
\nimport { ref, onMounted } from 'vue';\nimport { useRect } from '@vant/use';\n\nexport default {\n setup() {\n const root = ref();\n\n onMounted(() => {\n const rect = useRect(root);\n console.log(rect); // -> the size of an element and its position relative to the viewport\n });\n\n return { root };\n },\n};\n
\nfunction useRect(\n element: Element | Window | Ref<Element | Window | undefined>,\n): DOMRect;\n
\nName | \nDescription | \nType | \n
---|---|---|
width | \nWidth of the element | \nnumber | \n
height | \nHeight of the element | \nnumber | \n
top | \nThe distance from the top to the top-left of the viewport | \nnumber | \n
left | \nThe distance from the left to the top-left of the viewport | \nnumber | \n
right | \nThe distance from the right to the top-left of the viewport | \nnumber | \n
bottom | \nThe distance from the bottom to the top-left of the viewport | \nnumber | \n