I'm trying to use Vuelidate with Vue 3. When I try and add some validators to a component I get the following error:
index.js?1dce:614 Uncaught (in promise) TypeError: Cannot read property 'super' of undefined
I believe this is to do with the way I am using Vuelidate with the Vue instance. Here is my main.js file:
import { createApp } from 'vue';
import App from './App.vue';
import Vuelidate from 'vuelidate';
const app = createApp(App);
app.use(Vuelidate);
app.mount('#app');
I will also include the component code:
<template>
<div id="signup">
<div class="signup-form">
<form>
<div class="input">
<label for="email">Mail</label>
<input
type="email"
id="email"
@input="$v.email.$touch()"
v-model="email">
<div>{{ $v }}</div>
</div>
</form>
</div>
</div>
</template>
<script>
import { required, email } from 'vuelidate/lib/validators'
export default {
data () {
return {
email: '',
}
},
validations: {
email: {
required: required,
email: email
}
}
}
}
</script>
Does anyone know how to fix this? If Vue 3 is not compatible with Vuelidate, can anyone recommend and alternative that is?
Thanks