FormItem
Standalone form item component for building custom form layouts. This component is extracted from EzDynamicForm as a basic form item functionality.
Basic Usage
Component Types
Form Validation
Custom Slots
Attributes
| Attribute | Description | Type | Required | Default |
|---|---|---|---|---|
| v-model | Form data | any | No | - |
| config | Form item config | FormItemConfig | Yes | - |
| formData | Overall form data | Record<string, any> | No | {} |
FormItemConfig
| Attribute | Description | Type | Required | Default |
|---|---|---|---|---|
| prop | Field name | string | Yes | - |
| label | Label | string | No | - |
| type | Component type | FormItemType | string | No | - |
| defaultValue | Default value | any | No | - |
| rules | Validation rules | FormItemRule | No | - |
| required | Whether required | boolean | No | false |
| requiredMessage | Required message | string | No | - |
| span | Grid column span | number | No | - |
| hidden | Whether to hide | boolean | No | false |
| disabled | Whether disabled | boolean | No | false |
| placeholder | Placeholder (auto-generated by type when omitted; for range types use startPlaceholder / endPlaceholder) | string | No | - |
| startPlaceholder | Range-type start placeholder | string | No | - |
| endPlaceholder | Range-type end placeholder | string | No | - |
| options | Options configuration | FormItemOption[] | No | - |
| attrs | Component attributes | Record | No | - |
| component | Custom component | Component | No | - |
| itemAttrs | Extra el-form-item attributes | Record | No | - |
| show | Conditional display | Function | No | - |
| disabledWhen | Conditional disable | Function | No | - |
| serialize | Serialize a field before submit; returning an object with value/fields/omit keys is treated as a transform output, otherwise written back as a plain value. Useful for splitting date ranges, cleaning values or deriving extra fields | Function | No | - |
| deserialize | Deserialize when backfilling external data into the form | Function | No | - |
TIP
For FormItemType enum definition, please refer to DynamicForm Component Documentation
Slots
| Slot Name | Description | Parameters |
|---|---|---|
| — | Custom form content | { config: FormItemConfig, value: any, formData: Record } |
| label | Custom label content | { config: FormItemConfig } |
Events
| Event Name | Description | Type |
|---|---|---|
| update:modelValue | Triggered when value changes | Function |