fix(amis-saas-6852): 完善表单脚手架,自动补全options

Change-Id: Ie4ff0ecf9212a1336af224b70c9d95151037241d
This commit is contained in:
wibetter 2022-11-29 19:49:46 +08:00
parent a0429cf7aa
commit 398cdef083
2 changed files with 22 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "amis-editor",
"version": "5.2.1-beta.26",
"version": "5.2.1-beta.27",
"description": "amis 可视化编辑器",
"main": "lib/index.js",
"module": "esm/index.js",

View File

@ -182,7 +182,27 @@ export class FormPlugin extends BasePlugin {
}
]
}
]
],
pipeOut: (values: any) => {
// 给form中直接子元素单选框、复选框自动添加上默认options
if (values && values.type === 'form' && values.body?.length > 0) {
values.body.forEach((formItem: any) => {
if (formItem.type === 'radios' || formItem.type === 'checkboxes') {
formItem.options = [
{
label: "选项A",
value: "A"
},
{
label: "选项B",
value: "B"
}
];
}
});
}
return values;
}
};
// scaffoldForm: ScaffoldForm = {