vue validator code example
Example 1: submit form in vue
//HTML
//JS
vm = new Vue({
el : "#vueRoot",
methods : {
submit : function(){
this.$refs.form.submit()
}
}
});
Example 2: vuelidate same as
validations: {
form: {
old_password: {
data: { required },
},
new_password: {
data: { required },
},
repeat_password: {
data: {
sameAsPassword: sameAs(function() {
return this.form.new_password.data;
})
},
},
},
},
Example 3: vuelidate require if
required: requiredIf(()=> { return condition })