Add onInput method to form API
parent
c71ea19850
commit
9f8003ad9d
|
@ -38,6 +38,9 @@ export const useForm = (options = {}) => {
|
|||
states[field].touched = true;
|
||||
(fieldOptions?.validateOnBlur ?? isFieldValidate(field, options.validateOnBlur)) && validate(field);
|
||||
},
|
||||
onInput: (event) => {
|
||||
states[field].value = event.hasOwnProperty('value') ? event.value : event.target.value;
|
||||
},
|
||||
onChange: (event) => {
|
||||
states[field].value = event.hasOwnProperty('value') ? event.value : event.target.type === 'checkbox' || event.target.type === 'radio' ? event.target.checked : event.target.value;
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue