I'm having an undefined value when I put my object data inside the event.
Here are my codes:
data(){
return {
eventSources: [],
myId: 1
}
},
methods:{
myMethod(){
this.eventSources = [{
events(start,end,timezone,callback){
alert(this.myId);
axios.get(`/Something?id=${this.myId}`).then(response=>{
callback(response.data);
}).catch(error=>{console.log(error);});
}
}]
}
}
My alert is resulted to undefined
but when I put my alert above the this.eventSources = [{...]]
the alert has a value of 1
I hope somebody helps me.