Last active
September 20, 2020 14:48
-
-
Save NikitaKA/aa17c75b8f21b1118934d6390c4522ac to your computer and use it in GitHub Desktop.
Vuelidate email
This file contains hidden or 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> | |
<input ref="refEmailInput" type="email" v-model="$v.email.$model" /> | |
</template> | |
<script> | |
import { ref } from '@vue/composition-api'; | |
import useVuelidate from '@vuelidate/core'; | |
export default { | |
setup() { | |
const refEmailInput = ref(null); | |
const email = ref(''); | |
const $v = useVuelidate( | |
{ | |
email: { | |
valid() { | |
return refEmailInput.value.validity.valid; | |
}, | |
}, | |
}, { | |
} | |
); | |
return { | |
$v, | |
refEmailInput, | |
} | |
} | |
}; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment