Auto Binding
In this page, we will explain how auto binding works in Ez Form.
Updating data
Ez Form use prop value
and event onChange
to sync data with your input. You usually use value
to get data from input, so Ez Form do the same, but it is automatic.
If you want to get data from your custom input component, just make sure that your input component has two things bellow:
- Prop
value
: Form data will be pass to your input via this prop. - Event
onChange
: Ez Form will listen to this event to update data from your input.
You can change these props name by updating these options:
valuePropName
: The name ofvalue
prop in your input.changeEventName
: The name ofchange
event in your input.
These options may useful when working with checkbox or radio.
Blur event
By default, Ez Form will listen to event onBlur
to determine is input blur. So your component can emit onBlur
to be compatible with Ez Form.
You can change this event name by updating the following option:
blurEventName
: The name ofblur
event in your input.