mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 02:59:58 +08:00
docs: update api (#40544)
This commit is contained in:
parent
0a75cfe9e2
commit
2ec869132b
@ -1,17 +1,19 @@
|
||||
import React from 'react';
|
||||
import { Checkbox } from 'antd';
|
||||
import type { CheckboxValueType } from 'antd/es/checkbox/Group';
|
||||
import React from 'react';
|
||||
|
||||
const onChange = (checkedValues: CheckboxValueType[]) => {
|
||||
console.log('checked = ', checkedValues);
|
||||
};
|
||||
|
||||
const plainOptions = ['Apple', 'Pear', 'Orange'];
|
||||
|
||||
const options = [
|
||||
{ label: 'Apple', value: 'Apple' },
|
||||
{ label: 'Pear', value: 'Pear' },
|
||||
{ label: 'Orange', value: 'Orange' },
|
||||
];
|
||||
|
||||
const optionsWithDisabled = [
|
||||
{ label: 'Apple', value: 'Apple' },
|
||||
{ label: 'Pear', value: 'Pear' },
|
||||
|
@ -28,8 +28,6 @@ Checkbox component.
|
||||
|
||||
## API
|
||||
|
||||
### Props
|
||||
|
||||
#### Checkbox
|
||||
|
||||
| Property | Description | Type | Default | Version |
|
||||
@ -39,7 +37,7 @@ Checkbox component.
|
||||
| defaultChecked | Specifies the initial state: whether or not the checkbox is selected | boolean | false | |
|
||||
| disabled | If disable checkbox | boolean | false | |
|
||||
| indeterminate | The indeterminate checked state of checkbox | boolean | false | |
|
||||
| onChange | The callback function that is triggered when the state changes | function(e: CheckboxChangeEvent) | - | |
|
||||
| onChange | The callback function that is triggered when the state changes | (e: CheckboxChangeEvent) => void | - | |
|
||||
|
||||
#### Checkbox Group
|
||||
|
||||
@ -50,7 +48,17 @@ Checkbox component.
|
||||
| name | The `name` property of all `input[type="checkbox"]` children | string | - | |
|
||||
| options | Specifies options | string\[] \| number\[] \| Option\[] | \[] | |
|
||||
| value | Used for setting the currently selected value | (string \| number)\[] | \[] | |
|
||||
| onChange | The callback function that is triggered when the state changes | function(checkedValue) | - | |
|
||||
| onChange | The callback function that is triggered when the state changes | (checkedValue: CheckboxValueType[]) => void | - | |
|
||||
|
||||
##### Option
|
||||
|
||||
```typescript
|
||||
interface Option {
|
||||
label: string;
|
||||
value: string;
|
||||
disabled?: boolean;
|
||||
}
|
||||
```
|
||||
|
||||
### Methods
|
||||
|
||||
|
@ -29,8 +29,6 @@ demo:
|
||||
|
||||
## API
|
||||
|
||||
### 属性
|
||||
|
||||
#### Checkbox
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||
@ -40,7 +38,7 @@ demo:
|
||||
| defaultChecked | 初始是否选中 | boolean | false | |
|
||||
| disabled | 失效状态 | boolean | false | |
|
||||
| indeterminate | 设置 indeterminate 状态,只负责样式控制 | boolean | false | |
|
||||
| onChange | 变化时的回调函数 | function(e: CheckboxChangeEvent) | - | |
|
||||
| onChange | 变化时的回调函数 | (e: CheckboxChangeEvent) => void | - | |
|
||||
|
||||
#### Checkbox Group
|
||||
|
||||
@ -51,7 +49,7 @@ demo:
|
||||
| name | CheckboxGroup 下所有 `input[type="checkbox"]` 的 `name` 属性 | string | - | |
|
||||
| options | 指定可选项 | string\[] \| number\[] \| Option\[] | \[] | |
|
||||
| value | 指定选中的选项 | (string \| number)\[] | \[] | |
|
||||
| onChange | 变化时的回调函数 | function(checkedValue) | - | |
|
||||
| onChange | 变化时的回调函数 | (checkedValue: CheckboxValueType[]) => void | - | |
|
||||
|
||||
##### Option
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user