Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
fergaldoyle committed Oct 23, 2017
1 parent 0bfcdba commit d834aec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,16 +226,22 @@ Local custom validator
```js
// ...
methods: {
customValidator: function (value) {
// return true to set input as $valid, false to set as $invalid
return value === 'custom';
}
customValidator: function (value) {
// return true to set input as $valid, false to set as $invalid
return value === 'custom';
}
},
// local custom validator can also be a data or computed property
computed: {
isEmailAvailable function () {
// return true to set input as $valid, false to set as $invalid
}
}
// ...
```

```html
<validate :custom="{customValidator: customValidator}">
<validate :custom="{customValidator: customValidator, 'email-available': isEmailAvailable}">
<input v-model="something" name="something" />
<!--
slot name inside field-messages would be: <div slot="customValidator">...</div>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-form",
"version": "4.5.0",
"version": "4.5.1",
"description": "Form validation for Vue.js",
"main": "dist/vue-form.js",
"scripts": {
Expand Down

0 comments on commit d834aec

Please sign in to comment.