goPlay: function (e) {
var that = this;
that.setData({
audioIndex: e.target.dataset.current
})
wx.getBackgroundAudioPlayerState({
success: function (res) {
var status = res.status
var dataUrl = res.dataUrl
if (status == "0" || dataUrl != that.data.audioList.tracks.list[e.target.dataset.current].playPathAacv164){
that.playAudio(e.target.dataset.current);
}else{
wx.pauseBackgroundAudio();
that.setData({
audioIndex: -1
})
}
},
fail:function (){
that.playAudio(e.target.dataset.current);
}
})
},
playAudio:function(index){
wx.playBackgroundAudio({
dataUrl: that.data.audioList.tracks.list[index].playPathAacv164,
title: that.data.audioList.tracks.list[index].title,
coverImgUrl: that.data.audioList.tracks.list[index].smallLogo
})
},
这是什么问题
playAudio:function里没有定义that呀,加一句var that=this就行了。