<image wx:else class="collect" src="/images/collected.png" bindtap="collectMusic"></image>
<image class="previous" src="/images/previous.png" bindtap="playPrevious"></image>
<image class="play" wx:if="{{playState==0}}" src="/images/play.png" bindtap="playMusic"></image>
<image class="play" wx:elif="{{playState==1}}" src="/images/pause.png" bindtap="playMusic" >
</image>
<image wx:else class="play" src="/images/resume.png" bindtap="playMusic"></image>
data: {
songName:"东京铁塔的幸福",
singer:"江美琪",
textLog:"",
deviceId: "",
name: "",
allRes:"",
serviceId:"",
readCharacteristicId:"",
writeCharacteristicId: "",
notifyCharacteristicId: "",
connected: true,
canWrite: false,
mtuSupport:false,
playState: 0,
collectState:false,
playMode:0,
count:-1,
tally:-1,
slider1: 50,
slider2: 50,
},
playMusic: async function(){
var playstatus=["playSong","pause","resume"]
var that = this;
that.data.tally++;
console.log("=======tally=======>" ,that.data.tally)
if( that.data.tally>2){
that.data.tally=0;
}
let status=playstatus[ that.data. tally];
that.data.playState= that.data.tally;
console.log("=======playState=======>" ,that.data.playState)
改变data里的变量要用this.setData。 直接this.data是没有用的
没有两个else ,是 if elif else
你这个两个wx:else 前面的if呢