Skip to content

Instantly share code, notes, and snippets.

@NikitaKA
Last active September 20, 2020 14:48
Show Gist options
  • Save NikitaKA/aa17c75b8f21b1118934d6390c4522ac to your computer and use it in GitHub Desktop.
Save NikitaKA/aa17c75b8f21b1118934d6390c4522ac to your computer and use it in GitHub Desktop.
Vuelidate email
<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;
},
},
}, {
email
}
);
return {
$v,
refEmailInput,
}
}
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment