1 | import { ComponentType } from 'react'
|
2 | import { StandardProps, CommonEventFunction, FormItemProps } from './common'
|
3 | interface CheckboxGroupProps extends StandardProps, FormItemProps {
|
4 | /** 表单组件中加上 name 来作为 key
|
5 | * @supported alipay, tt, h5
|
6 | */
|
7 | name?: string
|
8 |
|
9 | /** `<CheckboxGroup/>` 中选中项发生改变是触发 change 事件
|
10 | * @supported weapp, alipay, swan, tt, qq, jd, h5, rn
|
11 | */
|
12 | onChange?: CommonEventFunction<{
|
13 | value: string[]
|
14 | }>
|
15 | }
|
16 |
|
17 | /** 多项选择器,内部由多个checkbox组成
|
18 | * @classification forms
|
19 | * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony
|
20 | * @example
|
21 | * ```tsx
|
22 | * export default class PageCheckbox extends Component {
|
23 | * state = {
|
24 | * list: [
|
25 | * {
|
26 | * value: '美国',
|
27 | * text: '美国',
|
28 | * checked: false
|
29 | * },
|
30 | * {
|
31 | * value: '中国',
|
32 | * text: '中国',
|
33 | * checked: true
|
34 | * },
|
35 | * {
|
36 | * value: '巴西',
|
37 | * text: '巴西',
|
38 | * checked: false
|
39 | * },
|
40 | * {
|
41 | * value: '日本',
|
42 | * text: '日本',
|
43 | * checked: false
|
44 | * },
|
45 | * {
|
46 | * value: '英国',
|
47 | * text: '英国',
|
48 | * checked: false
|
49 | * },
|
50 | * {
|
51 | * value: '法国',
|
52 | * text: '法国',
|
53 | * checked: false
|
54 | * }
|
55 | * ]
|
56 | * }
|
57 | * render () {
|
58 | * return (
|
59 | * <View className='page-body'>
|
60 | * <View className='page-section'>
|
61 | * <Text>默认样式</Text>
|
62 | * <Checkbox value='选中' checked>选中</Checkbox>
|
63 | * <Checkbox style='margin-left: 20rpx' value='未选中'>未选中</Checkbox>
|
64 | * </View>
|
65 | * <View className='page-section'>
|
66 | * <Text>推荐展示样式</Text>
|
67 | * {this.state.list.map((item, i) => {
|
68 | * return (
|
69 | * <Label className='checkbox-list__label' for={i} key={i}>
|
70 | * <Checkbox className='checkbox-list__checkbox' value={item.value} checked={item.checked}>{item.text}</Checkbox>
|
71 | * </Label>
|
72 | * )
|
73 | * })}
|
74 | * </View>
|
75 | * </View>
|
76 | * )
|
77 | * }
|
78 | * }
|
79 | * ```
|
80 | * @see https://developers.weixin.qq.com/miniprogram/dev/component/checkbox-group.html
|
81 | */
|
82 | declare const CheckboxGroup: ComponentType<CheckboxGroupProps>
|
83 | export { CheckboxGroup, CheckboxGroupProps }
|