Skip to content

A2UI 单选框 Radio

通过 Schema 配置生成 XRadioGroup 单选组组件。

字段配置

json
{
  "name": "size",
  "label": "尺寸",
  "type": "radio",
  "props": {
    "options": [
      { "label": "小", "value": "small" },
      { "label": "中", "value": "medium" },
      { "label": "大", "value": "large" }
    ]
  }
}

Props 配置

属性类型默认值说明
disabledbooleanfalse禁用状态
optionsarray[]选项列表

options 格式

typescript
interface RadioOption {
  label: string    // 显示文本
  value: any       // 选项值
  disabled?: boolean  // 是否禁用
}

示例

基础单选组

json
{
  "name": "payment",
  "label": "支付方式",
  "type": "radio",
  "props": {
    "options": [
      { "label": "支付宝", "value": "alipay" },
      { "label": "微信", "value": "wechat" },
      { "label": "银行卡", "value": "bank" }
    ]
  }
}

渲染组件

A2UI Radio 字段会渲染为 XTO UI 的 XRadioGroup 组件:

vue
<XRadioGroup v-model="formData.size">
  <XRadioButton value="small">小</XRadioButton>
  <XRadioButton value="medium">中</XRadioButton>
  <XRadioButton value="large">大</XRadioButton>
</XRadioGroup>

相关链接

基于 MIT 许可发布