mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-10 16:32:32 +08:00
6.5 KiB
Executable File
6.5 KiB
Executable File
title | description | type | group | menuName | icon | order |
---|---|---|---|---|---|---|
Checkboxes 复选框 | 0 | null | Checkboxes | 9 |
用于实现多选。
基本用法
{
"type": "form",
"api": "https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/form/saveForm",
"controls": [
{
"name": "checkboxes",
"type": "checkboxes",
"label": "复选框",
"options": [
{
"label": "OptionA",
"value": "a"
},
{
"label": "OptionB",
"value": "b"
},
{
"label": "OptionC",
"value": "c"
},
{
"label": "OptionD",
"value": "d"
}
]
}
]
}
展示多行
可以配置columnsCount
属性调整展示列的个数
{
"type": "form",
"api": "https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/form/saveForm",
"controls": [
{
"name": "checkboxes1",
"type": "checkboxes",
"label": "默认的复选框",
"options": [
{
"label": "OptionA",
"value": "a"
},
{
"label": "OptionB",
"value": "b"
},
{
"label": "OptionC",
"value": "c"
},
{
"label": "OptionD",
"value": "d"
}
]
},
{
"type": "divider"
},
{
"name": "checkboxes2",
"type": "checkboxes",
"label": "显示两列的复选框",
"columnsCount": 2,
"options": [
{
"label": "OptionA",
"value": "a"
},
{
"label": "OptionB",
"value": "b"
},
{
"label": "OptionC",
"value": "c"
},
{
"label": "OptionD",
"value": "d"
}
]
}
]
}
属性表
当做选择器表单项使用时,除了支持 普通表单项属性表 中的配置以外,还支持下面一些配置
属性名 | 类型 | 默认值 | 说明 |
---|---|---|---|
options | Array<object> 或Array<string> |
选项组 | |
source | string 或 API |
动态选项组 | |
delimeter | string |
false |
拼接符 |
labelField | string |
"label" |
选项标签字段 |
valueField | string |
"value" |
选项值字段 |
joinValues | boolean |
true |
拼接值 |
extractValue | boolean |
false |
提取值 |
columnsCount | number |
1 |
选项按几列显示,默认为一列 |
checkAll | boolean |
false |
是否支持全选 |
defaultCheckAll | boolean |
false |
默认是否全选 |
creatable | boolean |
false |
新增选项 |
createBtnLabel | string |
"新增选项" |
新增选项 |
addControls | Array<表单项> | 自定义新增表单项 | |
addApi | API | 配置新增选项接口 | |
editable | boolean |
false |
编辑选项 |
editControls | Array<表单项> | 自定义编辑表单项 | |
editApi | API | 配置编辑选项接口 | |
removable | boolean |
false |
删除选项 |
deleteApi | API | 配置删除选项接口 |