I'm guessing that it has to do something with Vue not detecting the changes in the tracks object.
mounted(){
Event.$emit('requestCurrentTrack');
Event.$on('currentSong', (data) => this.fetchAlbum(data)); //Data from this method won't output on the screen.
this.fetchAlbum(); // Data from this method out will output to the screen
},
methods:{
fetchAlbum(){
axios.get('/api/album/'+this.id).then((response)=>{
this.album = response.data[1][0];
this.tracks = response.data[0];
this.artistName = this.tracks[0].artist;
});
},
play(data, index){
if(data){
Event.$emit('playTrack', data, index);
}
}
}
Event.$onmethod is simply setting the event handler callback function. That function won't get called until thecurrentSongevent is emitted, which you aren't doing anywhere in the code you've shared. Also, you're passingdatato thethis.fetchAlbummethod, but that method doesn't take in a parameter.