数据录入与表单
NnRadioGroup 单选框组
管理普通或按钮式单选状态。
示例
API
Props
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
value | string | number | boolean | '' | 当前值,配合 v-model:value。 |
disabled | boolean | false | 禁用全部选项。 |
size | string | 'default' | small 使用小尺寸,其余为默认尺寸。 |
buttonStyle | string | 'outline' | solid 为实色按钮式外观,其余为轮廓外观。 |
optionType | string | 'default' | button 时由 options 生成 NnRadioButton,否则生成 NnRadio。 |
options | RadioOption[] | Primitive[] | [] | 非空时优先于默认插槽。原始值同时作为 label 和 value。 |
ts
interface RadioOption {
label: unknown;
value: string | number | boolean;
disabled?: boolean;
}Events
| 事件 | 参数 | 说明 |
|---|---|---|
update:value | (value) | 选择不同且可用的选项时触发。 |
change | ({ target: { value } }) | 组级变更载荷。 |
Slots
| 名称 | 作用域参数 | 说明 |
|---|---|---|
default | — | options 为空时放置 NnRadio 或 NnRadioButton。 |
