//1.设置audio
    const audio = wx.getBackgroundAudioManager()
    Page({
    ….
    handlePlay(event) {
    var {index} = event.currentTarget.dataset
    var {id,name,musicUrl} = this.data.musics[index];
    if (id !== this.data.prevId) {
    audio.title = name;
    audio.src = musicUrl;
    this.setData({
    isPlay: true,
    prevId: id
    })
    } else {
    / 点击之后,将id设置给prevId /
    if(this.data.isPlay){
    audio.pause();
    this.setData({
    isPlay:false
    })
    }else{
    audio.title = name;
    audio.src = musicUrl;
    this.setData({
    isPlay:true
    })
    }
    }
    }
    })