types(IndexBar): add IndexBarInstance type (#9246)

This commit is contained in:
neverland
2021-08-12 10:15:18 +08:00
committed by GitHub
parent a589fc2d12
commit 713be26ed2
5 changed files with 48 additions and 8 deletions
+13
View File
@@ -99,6 +99,19 @@ Use [ref](https://v3.vuejs.org/guide/component-template-refs.html) to get IndexB
| --- | --- | --- | --- |
| scrollTo | scroll to target element | _index: number \| string_ | - |
### Types
Get the type definition of the IndexBar instance through `IndexBarInstance`.
```ts
import { ref } from 'vue';
import type { IndexBarInstance } from 'vant';
const indexBarRef = ref<IndexBarInstance>();
indexBarRef.value?.scrollTo('B');
```
### IndexAnchor Slots
| Name | Description |