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
You can do so much more than this, for more info [check the composition API documentation](https://vee-validate.logaretm.com/v4/guide/composition-api/validation/).
126
+
78
127
#### Declarative Components
79
128
80
129
Higher-order components are better suited for most of your cases. Register the `Field` and `Form` components and create a simple `required` validator:
@@ -99,42 +148,14 @@ Then use the `Form` and `Field` components to render your form:
99
148
100
149
```vue
101
150
<Form v-slot="{ errors }">
102
-
<Field name="field" :rules="isRequired" />
151
+
<Field name="email" :rules="isRequired" />
103
152
104
-
<span>{{ errors.field }}</span>
153
+
<span>{{ errors.email }}</span>
105
154
</Form>
106
155
```
107
156
108
157
The `Field` component renders an `input` of type `text` by default but you can [control that](https://vee-validate.logaretm.com/v4/api/field#rendering-fields)
109
158
110
-
#### Composition API
111
-
112
-
If you want more fine grained control, you can use `useField` function to compose validation logic into your component:
113
-
114
-
```js
115
-
import { useField } from'vee-validate';
116
-
117
-
exportdefault {
118
-
setup() {
119
-
// Validator function
120
-
constisRequired=value=> (value ?true:'This field is required');
You can do so much more than this, for more info [check the composition API documentation](https://vee-validate.logaretm.com/v4/guide/composition-api/validation/).
126
+
78
127
#### Declarative Components
79
128
80
129
Higher-order components are better suited for most of your cases. Register the `Field` and `Form` components and create a simple `required` validator:
@@ -99,42 +148,14 @@ Then use the `Form` and `Field` components to render your form:
99
148
100
149
```vue
101
150
<Form v-slot="{ errors }">
102
-
<Field name="field" :rules="isRequired" />
151
+
<Field name="email" :rules="isRequired" />
103
152
104
-
<span>{{ errors.field }}</span>
153
+
<span>{{ errors.email }}</span>
105
154
</Form>
106
155
```
107
156
108
157
The `Field` component renders an `input` of type `text` by default but you can [control that](https://vee-validate.logaretm.com/v4/api/field#rendering-fields)
109
158
110
-
#### Composition API
111
-
112
-
If you want more fine grained control, you can use `useField` function to compose validation logic into your component:
113
-
114
-
```js
115
-
import { useField } from'vee-validate';
116
-
117
-
exportdefault {
118
-
setup() {
119
-
// Validator function
120
-
constisRequired=value=> (value ?true:'This field is required');
0 commit comments