docs(@vant/use): add useEventListener doc

This commit is contained in:
chenjiahan
2020-10-04 18:23:31 +08:00
parent 08d97ed567
commit c24d0aaa00
2 changed files with 78 additions and 3 deletions
@@ -31,9 +31,7 @@ export default {
通过 `eventName` 选项可以自定义需要监听的事件类型。
```html
<template>
<div ref="root" />
</template>
<div ref="root" />
```
```js
@@ -56,6 +54,20 @@ export default {
};
```
## 类型定义
```ts
type Options = {
eventName?: string;
};
function useClickAway(
target: Element | Ref<Element>,
listener: EventListener,
options?: Options
): void;
```
## 参数
| 参数 | 说明 | 类型 | 默认值 |