小程序计时器
onReady(){
let _this = this;
_this.countInterval();
},
countInterval: function () {
let _this = this
// 设置倒计时 定时器 每2000毫秒执行一次
_this.countTimer = setInterval(() => {
_this.getIndexData();
},5000);
},
getIndexData(options){
let _this = this;
// 提交到后端
App._post_form('index/wait_order', { order_id:1}, function (result) {
if (result.data.orderinfo.order_status==2){
_this.setData({ order_status: result.data.orderinfo.order_status});
clearInterval(_this.countTimer);
}
});
}