page loads, then gets the data from the background, and then binds it to the array in data with set. If you want to use the updated data in mounted, you can"t get it all the time, and it should be a problem of asynchronous loading, but you can"t solve it.
//axios created
innerBase().then(res =>{
this.$set(this.$data,"musicList",res.data.playlist.tracks)
//musicList
})
data {
return {
musicList:""
}
}
//mounted
console.log(this.musicList) // null
this.playMusic(this.musicList[0]);