docs(@vant/use): add vuepress

This commit is contained in:
chenjiahan
2020-10-04 19:42:44 +08:00
parent 79493de49d
commit ca860fda5f
14 changed files with 7349 additions and 112 deletions
@@ -0,0 +1,51 @@
# useScrollParent
获取元素最近的可滚动父元素。
## 代码演示
### 基本用法
```html
<div ref="root" />
```
```js
import { watch } from 'vue';
import { useScrollParent, useEventListener } from '@vant/use';
export default {
setup() {
const root = ref();
const scrollParent = useScrollParent(root);
useEventListener(
'scroll',
() => {
console.log('scroll');
},
{ target: scrollParent }
);
return { root };
},
};
```
## 类型定义
```ts
function useScrollParent(element: Ref<Element>): Ref<Element>;
```
## 参数
| 参数 | 说明 | 类型 | 默认值 |
| ------- | -------- | --------------- | ------ |
| element | 当前元素 | _Ref\<Element>_ | - |
## 返回值
| 参数 | 说明 | 类型 | 默认值 |
| ------------ | ------------------ | --------------- | ------ |
| scrollParent | 最近的可滚动父元素 | _Ref\<Element>_ | - |