Package Exports
- willvalidate
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (willvalidate) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
willvalidate
Validation Forms
Setup
Install dependencies
npm install willvalidate --saveInto main.js vuejs (Single File Components)
import Vue from 'Vue'
import willvalidate from 'willvalidate'
Vue.use(willvalidate)Usage
Ex: within methods
export default {
methods:{
sendForm()
{
this.willvalidate( document.querySelector("#form") ) ? console.log("ok") : console.log("error")
}
}
}Or in script tag
<script src="./PATH/node_modules/willvalidate/dist/willvalidate.js"></script>Use Attr html5 for validation
Ex: require, maxlength, minlength, type, pattern, min, max and othersCustomize
# error class
.has-danger{}
# set errorMessage | optional - if not informed will show default message
Ex: <input type="number" min="5" max="20" errorMessage="Preencha corretamente" required />