title: Control configuration

Control configuration

The control configuration item can be used to control whether other components are displayed by the value of the component

Examples

control

Online example

Maker

  1. maker.radio('Whether or not', 'is_postage', 0).options([
  2. {value: 0, label: 'No mail', disabled: false},
  3. {value: 1, label: 'FREE', disabled: false},
  4. ]).control([
  5. {
  6. value: 1,
  7. rule: [
  8. maker.number ('Full Amount', 'postage_money', 0)
  9. ]
  10. }
  11. ])

JSON

  1. {
  2. type: "radio",
  3. title: "Whether it is free",
  4. field: "is_postage",
  5. value: 0,
  6. options: [
  7. {value: 0, label: 'No mail', disabled: false},
  8. {value: 1, label: 'FREE', disabled: false},
  9. ],
  10. control: [
  11. {
  12. value: 1,
  13. rule: [
  14. {
  15. type: 'number',
  16. field: 'postage_money',
  17. title: 'Full Amount',
  18. value: 0
  19. },
  20. ]
  21. }
  22. ]
  23. }

Property description

  • value: Display the components in rule when the value of the component is equal tovalue

    1. {
    2. value: 1,
    3. rule: [...]
    4. }
  • handle Function: Display the components inrule when the handle method returnstrue

    1. {
    2. handle: function (val, $f) {
    3. return val === 1;
    4. },
    5. rule: [...]
    6. }
  • rule Array: This component controls the displayed components

    1. {
    2. value: 1,
    3. rule: [
    4. maker.number ('Full Amount', 'postage_money', 0)
    5. ]
    6. }