EzForm Component API
Props
| Name | Description | Type |
|---|---|---|
| name | Form's name | string |
| form | A FormInstance to control form from outside | FormInstance |
| initialValues | Initial values for form data | Record<string, any> |
| rules | Validation rules | Rules |
| validateTrigger | Config field validate trigger | ValidateTrigger | ValidateTrigger[] |
| validateMessages | Custom validation messages | ValidateMessages |
| classPrefix | Custom class prefix to generate form's class | string |
| preserveValues | Keep field value even when field removed | boolean |
Events
| Name | Description | Type |
|---|---|---|
| onSubmit | Trigger after submitting the form and validating data successfully | (values: any) => void |
| onError | Trigger after submitting the form and validating data failed | (errors: ValidateError[]) => void |
| onChange | Trigger when value updated | (values: any) => void |
Scoped slot - Default
| Name | Description | Type |
|---|---|---|
| values | Form's values | any |
| errors | Form's errors | ValidateError[] |
| dirty | Determine if form is dirty | boolean |
| submit | Function to submit form | FormInstance['submit'] |
| reset | Function to reset form's data and state | FormInstance['reset'] |
| validate | Function to reset validate form's data | FormInstance['validate'] |
| getFieldValue | Function to get form's field data | FormInstance['getFieldValue'] |
| setFieldValue | Function to set form's field data | FormInstance['setFieldValue'] |
| isDirty | Function to check if form's field is dirty | FormInstance['isDirty'] |
Ez Form