微信小程序轮播图加个倒计时代码,轮播图就出现问题?
微信小程序加了
countDown:function(){ // 倒计时函数
let that=this;
this.timers=setInterval(function(){
let lefttime = parseInt((new Date(that.jssj.replace(/-/g,"/")).getTime() - new Date().getTime()));
if(lefttime <= 0) {
that.qgdjs_jo={day:"00",hour:"00",min:"00"};
clearInterval(that.timers);
return;
}
let d = parseInt(lefttime /1000 /3600 /24); //天数
let h = parseInt(lefttime / 1000 / 3600 % 24); //小时
let m = parseInt(lefttime / 1000 / 60 % 60); //分钟
// var s = parseInt(lefttime / 1000 % 60); //当前的秒
d < 10 ? d = "0" + d : d;
h < 10 ? h = "0" + h : h;
m < 10 ? m = "0" + m : m;
// s < 10 ? s = "0" + s : s;
that.qgdjs_jo={ day: d, hour: h, min: m }
},1000)
},
这段代码,轮播图就出现问题,速度变快,也轮播不到第三张,有没有大佬知道啊
1 回复