I'm experiencing an issue when trying to assign a property to an empty object defined in the data using prototype. I keep getting an error that the object is undefined, but this error only occurs when using "prototype". What should I do?
This question pertains to [email protected], as well as [email protected] and [email protected]. The following code snippet is part of a component imported into another component.
<template>
<input class="input" v-model="RealName" placeholder="Your Name"/>
...
</template>
<script>
export default {
name: "Person",
data() {
return {
Email: null,
RealName: null,
Ncode: null,
City: null,
Education: null,
Phone: null,
static: {}
}
},
watch: {
RealName: function(changed, lastOne){
this.static.prototype.firstRealName = this.static.firstRealName | lastOne // -- Issue --
console.log(this.static.firstRealName + ': ' + lastOne +' => ' + changed)
}
}
};
</script>
Whenever I try editing the input, I encounter the following error in the console: “TypeError: Cannot set property 'firstRealName' of undefined ...”