Easy form validation plugin
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
dist 1.0 Oct 30, 2016
src 1.0 Oct 30, 2016
.gitignore 1.0 Oct 30, 2016
README.md Update README.md Oct 30, 2016
package.json
webpack.config.js

README.md

Vue-Easy-Validator

Easy form validator, bridge of vee-validate

Install

npm install vue-easy-validator --save
import VueEasyValidator from 'vue-easy-validator'

Vue.use(VueEasyValidator)

Usage

Template

  <input v-model="form.$fields.email" type="text">
  <p v-if="form.$errors.has('email')">{{form.$errors.first('email')}}</p>
  <input v-model="form.$fields.password" type="password">
  <p v-if="form.$errors.has('password')">{{form.$errors.first('password')}}</p>

Script

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
      }
  })