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 | string | No | - |
| options | Options configuration | FormItemOption[] | No | - |
| attrs | Component attributes | Record | No | - |
| slotName | Slot name for custom render | string | No | - |
| component | Custom component | Component | No | - |
| itemAttrs | Extra el-form-item attributes | Record | No | - |
| show | Conditional display | Function | No | - |
| disabledWhen | Conditional disable | 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 } |
Events
| Event Name | Description | Type |
|---|---|---|
| update:modelValue | Triggered when value changes | Function |