types(Checkbox): add CheckboxInstance type (#9140)

This commit is contained in:
neverland
2021-07-28 17:37:08 +08:00
committed by GitHub
parent 51b7a66913
commit 4dd03edf76
4 changed files with 60 additions and 5 deletions
+13
View File
@@ -345,6 +345,19 @@ checkboxGroup.toggleAll({
| --- | --- | --- | --- |
| toggle | 切换选中状态,传 `true` 为选中,`false` 为取消选中,不传参为取反 | _checked?: boolean_ | - |
### Checkbox 类型定义
通过 `CheckboxInstance` 获取 Checkbox 实例的类型定义。
```ts
import { ref } from 'vue';
import type { CheckboxInstance } from 'vant';
const checkboxRef = ref<CheckboxInstance>();
checkboxRef.value?.toggle();
```
### 样式变量
组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider 组件](#/zh-CN/config-provider)。