/*! For license information please see 6920.6faacda8.js.LICENSE.txt */ (self.webpackChunk=self.webpackChunk||[]).push([["6920"],{72155:function(n,s,t){"use strict";t.r(s);var a=t("80681");let e=["innerHTML"];s.default={setup:()=>({html:""}),render:()=>((0,a.wg)(),(0,a.iD)("div",{class:"van-doc-markdown-body",innerHTML:'

useRect

\n

\u4ECB\u7ECD

\n

\u83B7\u53D6\u5143\u7D20\u7684\u5927\u5C0F\u53CA\u5176\u76F8\u5BF9\u4E8E\u89C6\u53E3\u7684\u4F4D\u7F6E\uFF0C\u7B49\u4EF7\u4E8E Element.getBoundingClientRect\u3002

\n

\u4EE3\u7801\u6F14\u793A

\n

\u57FA\u672C\u7528\u6CD5

\n
<div ref="root" />\n
\n
import { 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); // -> \u5143\u7D20\u7684\u5927\u5C0F\u53CA\u5176\u76F8\u5BF9\u4E8E\u89C6\u53E3\u7684\u4F4D\u7F6E\n    });\n\n    return { root };\n  },\n};\n
\n

API

\n

\u7C7B\u578B\u5B9A\u4E49

\n
function useRect(\n  element: Element | Window | Ref<Element | Window | undefined>,\n): DOMRect;\n
\n

\u8FD4\u56DE\u503C

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\u53C2\u6570\u8BF4\u660E\u7C7B\u578B
width\u5BBD\u5EA6number
height\u9AD8\u5EA6number
top\u9876\u90E8\u4E0E\u89C6\u56FE\u7A97\u53E3\u5DE6\u4E0A\u89D2\u7684\u8DDD\u79BBnumber
left\u5DE6\u4FA7\u4E0E\u89C6\u56FE\u7A97\u53E3\u5DE6\u4E0A\u89D2\u7684\u8DDD\u79BBnumber
right\u53F3\u4FA7\u4E0E\u89C6\u56FE\u7A97\u53E3\u5DE6\u4E0A\u89D2\u7684\u8DDD\u79BBnumber
bottom\u5E95\u90E8\u4E0E\u89C6\u56FE\u7A97\u53E3\u5DE6\u4E0A\u89D2\u7684\u8DDD\u79BBnumber
\n
'},null,8,e))}}}]);