A2UI 开关 Switch
通过 Schema 配置生成 XSwitch 开关组件。
字段配置
json
{
"name": "active",
"label": "是否激活",
"type": "switch",
"props": {
"activeText": "启用",
"inactiveText": "禁用"
}
}Props 配置
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| disabled | boolean | false | 禁用状态 |
| activeText | string | - | 激活状态文字 |
| inactiveText | string | - | 未激活状态文字 |
| activeValue | any | true | 激活时的值 |
| inactiveValue | any | false | 未激活时的值 |
示例
基础开关
json
{ "name": "enabled", "label": "启用", "type": "switch" }带文字开关
json
{
"name": "status",
"label": "状态",
"type": "switch",
"props": {
"activeText": "开",
"inactiveText": "关"
}
}默认值
Switch 字段默认值为 false。
渲染组件
A2UI Switch 字段会渲染为 XTO UI 的 XSwitch 组件:
vue
<XSwitch v-model="formData.active" />相关链接
- XSwitch 组件文档 - XTO UI 开关详细说明
- A2UI 表单 - 表单整体配置