Skip to content

Commit 45a8d7c

Browse files
committed
docs(useFieldValidate): document arguments, fix example and add returned errors
1 parent d3efdef commit 45a8d7c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

apps/docs/guide/composables/useFieldValidate.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,18 @@ Field schema object, as returned by the props
3030

3131
### `validate` <Badge type="info" text="Function"/>
3232
> Validates the field, existing fields typically use this in an `onBlur()`
33+
- Arguments:
34+
- `currentModelValue: any` - the current value of the field.
3335
- Returns: `Promise<string[]>` - an array of error messages, or empty array if no errors have been found.
3436
```javascript
35-
validate().then((validationErrors) => {
37+
validate(currentModelValue.value).then((validationErrors) => {
3638
//...
3739
})
3840
```
41+
42+
### `errors` <Badge type="info" text="string[]" />
43+
> An array of errors that have been found when validating the current value against all validators
44+
45+
::: warning
46+
If you want your component to work properly with validation, you'll have to expose this value.
47+
:::

0 commit comments

Comments
 (0)