定时器
发布于 6 年前 作者 mren 11730 次浏览 来自 问答

timer = setInterval(function () {

nowTime -=1

if (nowTime == -1) {

that.setData({

awaitShow: false,

playTime: 0,

playIndex: parseInt(that.data.playIndex) + 1,

scrollIndex: that.data.playIndex+1

})

clearInterval(timer)

timer = null

if (that.data.systemMes == ‘i’) {

that.musicNow.pause()

} else {

that.awaitMusic.pause()

that.awaitMusic.destroy()

}

that.playTimeNow()

} else {

that.setData({

playTime: all - nowTime,

nowTime: (parseInt(nowTime / 60) >= 10 ? parseInt(nowTime / 60) : (“0” + parseInt(nowTime / 60))) + “:” + (parseInt(nowTime % 60) < 10 ? (“0” + parseInt(nowTime % 60)) : parseInt(nowTime % 60))

})

if (that.data.nowTime == “00:03”) {

that.resetMusic.play()

if (that.data.systemMes == ‘i’) {

that.musicNow.pause()

} else {

that.awaitMusic.pause()

that.awaitMusic.destroy()

}

}

}

}, 1000)

有时侯会出现卡顿,卡顿之后会跳过某一段时间

1 回复

两眼一抹黑,你在打什么

一屏幕代码,猜都猜不来


回到顶部