countTime(){
var that = this;
var timer = setInterval(() => {
var canbuy=that.data.can_buy;
var date = new Date();
var now = date.getTime();
var endDate = new Date(that.data.expirtime);//设置截止时间
var end = endDate.getTime();
var leftTime = end - now; //时间差
var m, s, ms;
if (leftTime > 0) {
m = Math.floor(leftTime / 1000 / 60 % 60);
s = Math.floor(leftTime / 1000 % 60);
ms = Math.floor(leftTime % 1000);
ms = ms < 100 ? "0" + ms : ms
s = s < 10 ? "0" + s : s
m = m < 10 ? "0" + m : m
canbuy=true
} else {
canbuy=false
m=0
s=0
ms=0
}
m==0?'00':m,
s==0?'00':s,
that.setData({
countdownTime:m+':'+s,
can_buy:canbuy
})
if(!canbuy){
clearInterval(timer)
}
}, 500)
}
上线之后iphone11、iphone12倒计时都无效,用setTimeout函数也无效
ios newDate 时间分隔需要-这个符号 不能/
请问后面ok了的程序能截图看看吗?我也遇到了同样的问题,iPhone真机计时显示一直为0