You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -79,7 +79,7 @@ vee-validate offers two styles to integrate form validation into your Vue.js app
79
79
80
80
The fastest way to create a form and manage its validation, behavior, and values is with the composition API.
81
81
82
-
Create your form with `useForm` and then use `defineInputBinds` to create your fields bindings and `handleSubmit` to use the values and send them to an API.
82
+
Create your form with `useForm` and then use `defineField` to create your field model and props/attributes and `handleSubmit` to use the values and send them to an API.
This is deprecated, please use `defineField` instead.
642
+
643
+
</DocTip>
644
+
639
645
This creates a bindable object for the specified field. The bindable object only works with native HTML input elements, for components use `defineComponentBinds` instead.
640
646
641
647
The `defineInputBinds` must be called in the `setup` function.
This is deprecated, please use `defineField` instead.
679
+
680
+
</DocTip>
681
+
670
682
This creates a bindable object for the specified field. The bindable object only works with components, for native HTML input elements use `defineInputBinds` instead.
671
683
672
684
The `defineComponentBinds` must be called in the `setup` function.
You can configure the props/attributes that are bound to the component by passing a second argument to `defineField`. You can use this configuration to adjust the `field` validation behavior and more with the individual elements you are using or the component library of your choice. Check the [UI library examples](/examples/ui-libraries) for live examples.
742
+
743
+
```ts
744
+
const [field, props] =defineField('field', {
745
+
// A getter that computes and adds any additional props to the component
746
+
// It receives the current field state as an argument
747
+
props(state) {
748
+
// This is just an example, by default this is an empty object
// A label for the field, only used with global validation rules
754
+
label: 'a label',
755
+
// Validates when `blur` event is emitted from the element/component
756
+
validateOnBlur: true,
757
+
// Validates when `change` event is emitted from the element/component
758
+
validateOnChange: true,
759
+
// Validates when `input` event is emitted from the element/component
760
+
validateOnInput: false,
761
+
// Validates when the returned model value changes
762
+
validateOnModelUpdate: true,
763
+
});
764
+
```
765
+
766
+
You can also have a lazy configuration by passing a function that returns the configuration object. The only difference is `props` is now a plain object instead of a getter function.
767
+
768
+
This means you can change any of the configuration based on the field state:
Copy file name to clipboardExpand all lines: packages/vee-validate/README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -79,7 +79,7 @@ vee-validate offers two styles to integrate form validation into your Vue.js app
79
79
80
80
The fastest way to create a form and manage its validation, behavior, and values is with the composition API.
81
81
82
-
Create your form with `useForm` and then use `defineInputBinds` to create your fields bindings and `handleSubmit` to use the values and send them to an API.
82
+
Create your form with `useForm` and then use `defineField` to create your field model and props/attributes and `handleSubmit` to use the values and send them to an API.
0 commit comments