docs(@vant/use): add useEventListener doc
This commit is contained in:
@@ -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;
|
||||
```
|
||||
|
||||
## 参数
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|
||||
Reference in New Issue
Block a user