types(Tabs): add TabsInstance type (#9174)

* types(Tabs): add TabsInstance type

* types: fix
This commit is contained in:
neverland
2021-08-03 20:30:21 +08:00
committed by GitHub
parent ff464c12fa
commit 795de3dd51
6 changed files with 58 additions and 19 deletions
+13
View File
@@ -280,6 +280,19 @@ Use [ref](https://v3.vuejs.org/guide/component-template-refs.html) to get Tabs i
| resize | Resize Tabs when container element resized or visibility changed | - | - |
| scrollTo | Go to specified tab in scrollspy mode | _name: string \| number_ | - |
### Types
Get the type definition of the Tabs instance through `TabsInstance`.
```ts
import { ref } from 'vue';
import type { TabsInstance } from 'vant';
const tabsRef = ref<TabsInstance>();
tabsRef.value?.scrollTo(0);
```
### Tabs Slots
| Name | Description |
+13
View File
@@ -291,6 +291,19 @@ export default {
| resize | 外层元素大小或组件显示状态变化时,可以调用此方法来触发重绘 | - | - |
| scrollTo | 滚动到指定的标签页,在滚动导航模式下可用 | _name: string \| number_ | - |
### 类型定义
通过 `TabsInstance` 获取 Tabs 实例的类型定义。
```ts
import { ref } from 'vue';
import type { TabsInstance } from 'vant';
const tabsRef = ref<TabsInstance>();
tabsRef.value?.scrollTo(0);
```
### Tabs Slots
| 名称 | 说明 |