InputSubForm 子表单

基本用法

```schema: scope=”body” { “type”: “form”, “debug”: true, “body”: [ { “type”: “input-sub-form”, “name”: “form”, “label”: “子Form”, “btnLabel”: “设置子表单”, “form”: { “title”: “配置子表单”, “body”: [ { “name”: “a”, “label”: “A”, “type”: “input-text” },

  1. {
  2. "name": "b",
  3. "label": "B",
  4. "type": "input-text"
  5. }
  6. ]
  7. }
  8. }
  9. ]

}

  1. ## 多选模式
  2. 可以配置`"multiple": true`,实现多选模式
  3. ```schema: scope="body"
  4. {
  5. "type": "form",
  6. "debug": true,
  7. "body": [
  8. {
  9. "type": "input-sub-form",
  10. "name": "form2",
  11. "label": "多选",
  12. "multiple": true,
  13. "maxLength": 3,
  14. "form": {
  15. "title": "配置子表单",
  16. "body": [
  17. {
  18. "name": "a",
  19. "label": "A",
  20. "type": "input-text"
  21. },
  22. {
  23. "name": "b",
  24. "label": "B",
  25. "type": "input-text"
  26. }
  27. ]
  28. }
  29. }
  30. ]
  31. }

设置按钮名称

```schema: scope=”body” { “type”: “form”, “debug”: true, “body”: [ { “type”: “input-sub-form”, “name”: “form2”, “label”: “多选”, “multiple”: true, “btnLabel”: “设置${title}”, “form”: { “title”: “配置子表单”, “body”: [ { “name”: “title”, “label”: “标题”, “required”: true, “type”: “input-text” }, { “name”: “b”, “label”: “其他”, “type”: “input-text” } ] } } ] }

  1. ## 支持拖拽
  2. ```schema: scope="body"
  3. {
  4. "type": "form",
  5. "debug": true,
  6. "body": [
  7. {
  8. "type": "input-sub-form",
  9. "name": "form2",
  10. "label": "多选",
  11. "multiple": true,
  12. "btnLabel": "设置${title}",
  13. "draggable": true,
  14. "addable": false,
  15. "removable": false,
  16. "value": [
  17. {
  18. "title": "a"
  19. },
  20. {
  21. "title": "b"
  22. },
  23. {
  24. "title": "c"
  25. },
  26. {
  27. "title": "d"
  28. }
  29. ],
  30. "form": {
  31. "title": "配置子表单",
  32. "body": [
  33. {
  34. "name": "title",
  35. "label": "标题",
  36. "required": true,
  37. "type": "input-text"
  38. },
  39. {
  40. "name": "b",
  41. "label": "其他",
  42. "type": "input-text"
  43. }
  44. ]
  45. }
  46. }
  47. ]
  48. }

属性表

除了支持 普通表单项属性表 中的配置以外,还支持下面一些配置

属性名 类型 默认值 说明
multiple boolean false 是否为多选模式
labelField string 当值中存在这个字段,则按钮名称将使用此字段的值来展示。
btnLabel string "设置" 按钮默认名称
minLength number 0 限制最小个数。
maxLength number 0 限制最大个数。
draggable boolean 是否可拖拽排序
addable boolean 是否可新增
removable boolean 是否可删除
addButtonClassName string `` 新增按钮 CSS 类名
itemClassName string `` 值元素 CSS 类名
itemsClassName string `` 值包裹元素 CSS 类名
form Form 子表单配置,同 Form
addButtonText string `` 自定义新增一项的文本
showErrorMsg boolean true 是否在左下角显示报错信息