Arrayitems https://antd5.formilyjs.org/zh-CN/components/array-items
const schema = {
"type": "object",
"properties": {
"contacts": {
"type": "array",
"x-component": "ArrayItems",
"x-decorator": "FormItem",
"title": "联系人",
"items": {
"type": "object",
"properties": {
"space": {
"type": "void",
"x-component": "Space",
"properties": {
"sort": {
"type": "void",
"x-decorator": "FormItem",
"x-component": "ArrayItems.SortHandle"
},
"name": {
"type": "string",
"title": "姓名",
"enum": [
{
"label": "张飞",
"value": 1
},
{
"label": "刘秀",
"value": 2
}
],
"x-decorator": "FormItem",
"x-component": "Select",
"x-component-props": {
"style": {
"width": 180
}
}
},
"phone": {
"type": "string",
"title": "手机号",
"x-decorator": "FormItem",
"x-component": "Input",
"x-validator": "phone",
"x-component-props": {
"maxLength": 11,
"showCount": true,
"placeholder": "请输入手机号"
},
"x-decorator-props": {
"style": { "flex": 1 }
},
"name": "phone",
"required": true,
"x-designable-id": "v0ojceniv88"
},
"remove": {
"type": "void",
"x-decorator": "FormItem",
"x-component": "ArrayItems.Remove",
"x-component-props": {
"style": { "width": 40 },
"className": "text-center"
}
}
}
}
}
},
"properties": {
"add": {
"type": "void",
"title": "添加条目",
"x-component": "ArrayItems.Addition",
"x-component-props": {
"type": "primary",
"ghost": true,
}
}
}
}
},
"x-designable-id": "4hzm4xnqmgl"
}