- 多个倒计时的实现
存在这样一个需求,一批订单包含未完成订单(含有倒计时提示),这里有知友关于VueJs的建议: 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); } } }
2017-06-20 - picker-view能否设置每个项目是否可选?
picker-view能否设置每个项目是否可选,如果不可选择,则跳转到可选择的项目: [图片] <picker-view indicator-style="height:40px" style="width:100%;height:200px" value="{{pickerViewValue}}" bindchange="selectBookTime"> <picker-view-column> <view wx:for="{{bookDateArr}}" class="pickerView {{index == 2 ? 'pickerViewDisabled' : ''}}" style="line-height:40px">{{item}}</view> </picker-view-column> <picker-view-column> <view wx:for="{{bookTimeArr}}" class="pickerView" style="line-height:40px">{{item}}</view> </picker-view-column> </picker-view>
2017-05-19