问题模块 框架类型 问题类型 API/组件名称 终端类型 微信版本 基础库版本
API和组件 微信小程序 Bug setInterval 客户端 6.7.3 2.2.4
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)
有时侯会出现卡顿,卡顿之后会跳过某一段时间
微信小程序开发问题解答
微信小程序开发者回答:
两眼一抹黑,你在打什么
一屏幕代码,猜都猜不来
---
微信小程序开发者回答:
就是定时器在调的时候,我会输出nowTime,有时nowTime会从00:30隔几秒钟之后直接到00:24,这间隔的时间之内没有输出
本文网址:http://www.91bianli.com/kaifazhinan/78331.html