Upon reviewing the documentation for Vuelidator
at this particular link, I encountered an error when attempting to utilize this specific javascript
package:
[Vue warn]: Error in v-on handler: "TypeError: target is undefined"
The process of installing the package within my project, specifically in app.js
, involved the following steps:
import Vue from "vue";
const {default: Vuelidate} = require('vuelidate')
Vue.use(Vuelidate)
require('./bootstrap');
window.Vue = require('vue').default;
new Vue({
components:
{
//...
}
}).$mount('#app');
Furthermore, the content of the user-profile
component is as follows:
import {mapGetters, mapMutations} from "vuex";
import { required, minLength, between } from 'vuelidate/lib/validators'
export default {
props: [
'user'
],
data() {
const userInfo = this.user;
return {
name: userInfo.name,
}
},
validations: {
name: {
required,
minLength: minLength(4)
}
},
computed: {
//...
},
methods: {
change_name({target}) {
this.$store.commit('change_name', target)
this.$v.name.$touch()
}
}
};
Additionally, the corresponding HTML
input tag is included below:
<input v-model.trim="name" type="text" name="name" dir="auto"
@input="change_name($event.target.value)"
class="form-control">
Why am I receiving a
"TypeError: target is undefined"
error and what steps can be taken to address this issue? Thank you in advance for your assistance.