data: show: true, count: "", timer: null, getCode() { const TIME_COUNT = 60; if (!this.timer) { this.count = TIME_COUNT; this.show = false; this.timer = setInterval(() => { if (this.count > 0 && this.count <= TIME_COUNT) { this.count -= 1; } else { this.show = true; clearInterval(this.timer); this.timer = null; } }, 1000); } },
}
setEndTime() { var _this = this; var interval = setInterval(function timestampToTime() { var FinishTime = new Date(_this.zero.end_time); var PresentTime = Date.parse(new Date()) / 1000; var Time = FinishTime - PresentTime; console.log(Time); if (Time < 0) { clearInterval(interval); } else { _this.day = parseInt(Time / 60 / 60 / 24); _this.hour = parseInt((Time / 60 / 60) % 24); _this.minute = parseInt((Time / 60) % 60); _this.secondsec = parseInt(Time % 60); if (_this.day < 10) { _this.day = "0" + _this.day; } if (_this.hour < 10) { _this.hour = "0" + _this.hour; } if (_this.minute < 10) { _this.minute = "0" + _this.minute; } if (_this.secondsec < 10) { _this.secondsec = "0" + _this.secondsec; } } }, 1000); },
},