5 回复
下面为什么不执行?
let interval = setInterval(()=>{
let {orderTime, staticTime} = this.state;
let nowTime = Date.now();
let sub = Math.floor((orderTime + staticTime - nowTime)/1000);
console.log('sub',sub);
if(sub<=0){
clearInterval(interval);
this.setState({
tip:'支付超时',
isFalse:true
});
return;
}
let minutes = parseInt(sub/60);
let Seconds = sub%60;
let tip = '订单已提交,请在'+minutes+'分'+Seconds+'秒内完成支付';
console.log(tip);
this.setState({
tip:tip,
isFalse:false
});
},1000);