-
-
Save uno-de-piera/13e2ea20a4d891292adc8dce783c3436 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div class="validation-component"> | |
<h1>Extender validaciones con Vuejs 2 + VeeValidate</h1> | |
<form novalidate @submit.prevent="validateAndSubmit" id="custom-form"> | |
<input type="password" v-model="password" name="password" v-validate="'required|min:8|verify_password'" /> | |
<p>{{ password }}</p> | |
<span v-if="errors.has('password')">{{ errors.first('password') }}</span> | |
</form> | |
</div> | |
</template> | |
<script> | |
export default { | |
name: 'ValidationComponent', | |
data () { | |
return { | |
password: '' | |
} | |
}, | |
methods: { | |
validateAndSubmit() { | |
this.$validator.validateAll().then((result) => { | |
if (result) { | |
console.log("success..."); | |
} else { | |
console.log(this.errors); | |
console.log("error..."); | |
} | |
}); | |
}, | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment