RodrigoSaint / vue-validatejs

This package is a validation component based on validate.js. It provides a simple and flexible way to validate and show error messages for individual properties.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vue-validatejs

This package is a validation component based on validate.js. It provides a simple and flexible way to validate and show error messages for individual properties.

Usage

Because it relies on validate.js, all examples about validations can be checked at their docs. To use this component you have to import it into your component.

  import VueValidate from 'vue-validatejs'
  
  export default {
    name: 'App',
    components: { VueValidate },

    data () {
      return { model: {}, validation: {name: {presence: {allowEmpty: false}}} }
    }
  }

Then in your html create a tag passing the model, the property to validate and the validation

<vue-validate :model="model" :validation="validation" property-name="name"></vue-validate>

And that's it. A error message will be generated if the field fail any validation.

About

This package is a validation component based on validate.js. It provides a simple and flexible way to validate and show error messages for individual properties.

License:MIT License


Languages

Language:JavaScript 57.1%Language:Vue 25.5%Language:HTML 17.4%