html52.com
我爱小程序-开发者交流社区

多个倒计时的实现

问题模块
API和组件

存在这样一个需求,一批订单包含未完成订单(含有倒计时提示),这里有知友关于VueJs的建议:

vue 列表循环倒计时(https://www.zhihu.com/question/47746149)。


vue 列表循环倒计时(https://www.zhihu.com/question/47746149)。请问怎样实现上图效果?


请问怎样实现上图效果?


function countDifftime(){
var self = this;
var orderList = self.data.orderList;
var i = 0;
var length = orderList.length;
for(; i < length; i++){
if(orderList[i].Status == 1){
var difftimer = setInterval(function(){
console.log(self.data.orderList[0].difftime);
console.log(self.data.orderList[i].difftime);
var oDifftime = orderList[i].difftime.split(":");
var h = Math.floor(difftime / 60 / 60);
var min = Math.floor(difftime / 60 % 60);
var sec = Math.floor(difftime % 60);
var sDifftime = "";
if(h <= 0 && min <= 0 && sec <= 0){
clearInterval(difftimer);
self.onShow();
}else{
sDifftime = common.formatNumber(h) + ":" + common.formatNumber(min) + ":" + common.formatNumber(sec);
orderList[i].difftime = sDifftime;
console.log("--------------" + JSON.stringify(self.data.orderList) + "--------------");
sec--;
if(sec < 0){
sec = 59;
min--;
if(min < 0){
min = 59;
h--;
}
}
}
self.setData({
"orderList": orderList
               });
}, 1000);
}
}
}


评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付