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

useScrollParent

\n

\u4ECB\u7ECD

\n

\u83B7\u53D6\u5143\u7D20\u6700\u8FD1\u7684\u53EF\u6EDA\u52A8\u7236\u5143\u7D20\u3002

\n

\u4EE3\u7801\u6F14\u793A

\n

\u57FA\u672C\u7528\u6CD5

\n
<div ref="root" />\n
\n
import { ref, watch } from 'vue';\nimport { useScrollParent, useEventListener } from '@vant/use';\n\nexport default {\n  setup() {\n    const root = ref();\n    const scrollParent = useScrollParent(root);\n\n    useEventListener(\n      'scroll',\n      () => {\n        console.log('scroll');\n      },\n      { target: scrollParent },\n    );\n\n    return { root };\n  },\n};\n
\n

API

\n

\u7C7B\u578B\u5B9A\u4E49

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

\u53C2\u6570

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\u53C2\u6570\u8BF4\u660E\u7C7B\u578B\u9ED8\u8BA4\u503C
element\u5F53\u524D\u5143\u7D20Ref<Element>-
\n

\u8FD4\u56DE\u503C

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\u53C2\u6570\u8BF4\u660E\u7C7B\u578B
scrollParent\u6700\u8FD1\u7684\u53EF\u6EDA\u52A8\u7236\u5143\u7D20Ref<Element>
\n
'},null,8,l))}}}]);