Closed postgetme closed 8 years ago
You can use $validate
the below.
<validator name="validation" @submit="onSubmit">
<input type="text" detect-change="off" detect-blur="off" v-validate:username="{ required: { rule: true, initial: 'off' }, minlength: { rule: 8, initial: 'off' }}">
<input type="submit" value="submit">
</validator>
new Vue({
methods: {
onSubmit: function (e) {
this.$validate('username', true, function () {
console.log('validate done !!')
})
if (this.$validation.invalid) {
e.preventDefault()
}
}
}
})
see the docs http://vuejs.github.io/vue-validator/en/api.html http://vuejs.github.io/vue-validator/en/timing.html
@kazupon thank you very much!
eg: does support "$myValidator.phone(true)" ?