Skip to content

Commit a47a8fc

Browse files
committed
fix: update readme
1 parent ed0dcb2 commit a47a8fc

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,18 @@ It will create `$errors` object inside components.
123123
| **clear(field)** | clear specific error by field name. |
124124
| **onKeydown(event, 'baseFormName')** | event to clear error by event.target.name. (input the has name). |
125125

126+
#### first(field || fields)
127+
128+
In some situations, you may wish to run validation checks against a field only if that field is present in the data being validated. To quickly accomplish this, add the sometimes rule to your rule list:
129+
130+
```js
131+
const errors = { name: [{ kh: ['This fist name field is required'] }] }
132+
133+
$errors.first('name') // return array
134+
$errors.first('name[0]') // return object like
135+
$errors.first('name[0].kh') // return string like
136+
```
137+
126138
## Using with Vuex
127139

128140
1.Create **proxies** folder or your prefer folder name for this

0 commit comments

Comments
 (0)