github logaretm/vee-validate vee-validate@4.1.2

latest releases: v4.14.7, v4.14.6, v4.14.5...
3 years ago

🆕 New Feature

  • added useSubmitForm composition API helper that functions similarly to handleSubmit but with a composition API style.
import { useSubmitForm } from 'vee-validate';

const submitForm = useSubmitForm((values, actions) => {
  // Send data to your api ...
  alert(JSON.stringify(values, null, 2));

  // You can perform any of the form actions using the actions object
  // set a single field value
  actions.setFieldValue('field', 'hello');
  // set multiple fields values
  actions.setValues({ email: 'value', password: 'hi' });
  // set a single field error
  actions.setFieldError('field', 'this field is bad');
  // set multiple fields errors
  actions.setErrors({ email: 'bad email', password: 'bad password' });
  // reset the form
  actions.resetForm();
});

Don't miss a new vee-validate release

NewReleases is sending notifications on new releases.