FxRadio 单选框 / FxRadioGroup / FxRadioBtn
不依赖任何 UI 框架。
基础用法
单选框组
禁用(disabled)
disabled 属性禁用单选框。
按钮样式
fill / text-color 自定义激活色。
v-for 渲染选项
数据驱动(options)
传入 options 与 option-props 即可自动渲染,type="button" 切换按钮形态。options 数组项除 label / value / disabled(字段名可由 option-props 重命名)外的其余字段会透传给子 FxRadio / FxRadioBtn,可作为额外属性(如 id、data-*)下发。
边框(border)
尺寸(size)
FxRadio Props
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| model-value (v-model) | string | number | boolean | — | 绑定值 |
| value | string | number | boolean | — | radio 的值 |
| label | string | number | boolean | — | 标签(value 缺省时兼作值) |
| size | 'large' | 'default' | 'small' | 'default' | 尺寸 |
| disabled | boolean | false | 是否禁用 |
| border | boolean | false | 是否显示边框 |
| name | string | — | 原生 name |
| aria-label | string | — | aria-label |
FxRadio Events
| 事件名 | 说明 |
|---|---|
| update:modelValue | 值变化 |
| change | 变化时 |
FxRadio Slots
| 插槽名 | 说明 |
|---|---|
default | 标签内容 |
FxRadioGroup Props
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| model-value (v-model) | string | number | boolean | — | 绑定值 |
| size | 'large' | 'default' | 'small' | — | 尺寸 |
| disabled | boolean | false | 禁用 |
| fill | string | '' | 按钮激活填充色(仅 button 模式) |
| text-color | string | '' | 按钮激活文字色(仅 button 模式) |
| name | string | — | 原生 name |
| aria-label | string | — | aria-label |
| validate-event | boolean | true | 值变化时是否触发表单项校验 |
| options | Array<Record<string, any>> | — | 选项数据,传入后无需手写子组件 |
| option-props | { label?, value?, disabled? } | — | options 的字段别名配置 |
| type | 'radio' | 'button' | 'radio' | 形态:普通单选 / 按钮形态 |
FxRadioBtn Props
同 FxRadio(无 border)。
