Radio 单选框
单选框组件,用于在多个选项中选择一个。
何时使用
- 用于在多个备选项中选中单个状态
- 和 Select 的区别是,Radio 所有选项默认可见,方便用户在比较中选择,因此选项不宜过多
代码演示
API
| 参数 | 说明 | 类型 | 默认值 |
| value | 选中的值 | string \| number | - |
| options | 选项列表 | RadioOption[] | [] |
| getOptions | 异步获取选项的函数 | () => Promise<RadioOption[]> | - |
| optionsType | 选项来源类型 | 'custom' \| 'dictionary' \| 'businessModel' | 'custom' |
| disabled | 是否禁用 | boolean | false |
RadioOption
| 参数 | 说明 | 类型 |
| label | 显示文本 | string |
| value | 选项值 | string \| number |
| disabled | 是否禁用此选项 | boolean |
事件
| 事件名 | 说明 | 回调参数 |
| change | 选中项变化时回调 | (value: string \| number) => void |