balloon-selector 字段渲染一个列表,其中一次只能选择一个项目。
气球选择器支持与 下拉字段类型 相同的选项定义方法。
gender:
type: balloon-selector
label: Gender
options:
female: Female
male: Male以下 字段属性 是常用的。
| Property | Description |
|---|---|
| label | a name when displaying the form field to the user. |
| default | a default value to use for new records. |
| comment | places a descriptive comment below the field. |
| options | available options for the dropdown, as an array. |
| optionsMethod | take options from a method defined on the model or as a static method, eg Class::method. |
| allowEmpty | allows the selection to be unset by clicking on the active item, default: false. |
您可以使用 default 属性来设置一个默认值,其中该值是选项的键。
gender:
type: balloon-selector
label: Gender
default: female将 allowEmpty 属性设置为 true 以允许用户通过取消选择活动项来设置空值。
gender:
type: balloon-selector
label: Gender
allowEmpty: true