Intro
vue-verify is a simple veriication plugin for vue,compatible with Vue.js 0.12.0+.
Usage
Import and install
Create a Vue instance,invoke $verify(rules) in the created lifecycle hook.
el: "#app" data: name: null age: 0 { //Vue.prototype.$verify(rules) this }
template code
name reqiured please enter no more than 16 characters age must greater than or equal to 16 age must smaller than or equal to 80 submit
Built-in verify methods
... { this }
Note: Get more information from examples.
Options
Vue;
You can also specify verification options for instance.
new Vue({
el: "#app",
data: {...},
created: function () {
this.$verify({...})
},
//specify verifier option
verifier: options
})
Namespace
Default is "verify".Can not specify in instance options since v0.6.0.
methods
Specify custom verify methods.
You can specify options global via
Vue.use(vueVerify,options)
.
Reset
You can reset the verify results with method $verifyReset()
of Vue instance.
Use in nodejs
npm install vue-verify --save-dev
var Vue =var VueVerify =Vue