types(DropdownItem): add DropdownItemInstance type (#9214)

This commit is contained in:
neverland
2021-08-09 17:06:55 +08:00
committed by GitHub
parent 92c06b2700
commit 2596166e95
8 changed files with 96 additions and 28 deletions
+16 -3
View File
@@ -188,9 +188,22 @@ Use `active-color` prop to custom active color of the title and options.
Use [ref](https://v3.vuejs.org/guide/component-template-refs.html) to get DropdownItem instance and call instance methods.
| Name | Description | Attribute | Return value |
| ------ | -------------- | --------------- | ------------ |
| toggle | Toggle display | _show: boolean_ | - |
| Name | Description | Attribute | Return value |
| ------ | -------------- | ---------------- | ------------ |
| toggle | Toggle display | _show?: boolean_ | - |
### Types
Get the type definition of the DropdownItem instance through `DropdownItemInstance`.
```ts
import { ref } from 'vue';
import type { DropdownItemInstance } from 'vant';
const dropdownItemRef = ref<DropdownItemInstance>();
dropdownItemRef.value?.toggle();
```
### Data Structure of Option