Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/MetinSeylan/Vue-Easy-Validator

Easy form validation plugin
https://github.com/MetinSeylan/Vue-Easy-Validator

Last synced: 3 months ago
JSON representation

Easy form validation plugin

Awesome Lists containing this project

README

        

# Vue-Easy-Validator
Easy form validator, bridge of vee-validate

## Install

``` bash
npm install vue-easy-validator --save
```

``` js
import VueEasyValidator from 'vue-easy-validator'

Vue.use(VueEasyValidator)
```

## Usage

### Template
``` html

{{form.$errors.first('email')}}



{{form.$errors.first('password')}}


```

### Script

``` js
new Vue({
data(){
return{
form: this.$form({
email: {
rule: 'email|required',
value: 'imamhatipler kapatılsın' // => set default value
},
password: {
rule: 'required|min:3',
value: null
}
})
}
},
mounted(){
console.log(this.form.$fields); // => Form values (dynamic)
console.log(this.form.$rules); // => Form rules (dynamic)
console.log(this.form.$errors); // Form errors (instance of vee-validate errorBag)
console.log(this.$validator); // => vee-validate instance
}
})
```