Updating work
parent
6a58aa50b3
commit
c0830dafe6
@ -0,0 +1,30 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<h1>Example for vuelidate</h1>
|
||||||
|
<input type="email" placeholder="What's your email" v-model="email">
|
||||||
|
<p v-if="!$v.email.email">Please enter a valid email.</p>
|
||||||
|
<p v-if="!$v.email.required">Email is required.</p>
|
||||||
|
<button :disabled="!$v.$invalid" type="submit">Submit</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { required, email } from 'vuelidate/lib/validators'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
email: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
validations: {
|
||||||
|
email: {
|
||||||
|
required, // Required validator ensures that the field has a value.
|
||||||
|
email // Email validator ensures that the value is indeed an email
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
</style>
|
Loading…
Reference in New Issue