let that = this;
setInterval(() => {
var intDiff = parseInt(that.detailsForm.time_surplus); //倒计时总秒数
var day = 0,
hour = 0,
minute = 0,
second = 0; //时间默认值
if (intDiff > 0) {
day = Math.floor(intDiff / (60 * 60 * 24));
hour = Math.floor(intDiff / (60 * 60)) - (day * 24);
minute = Math.floor(intDiff / 60) - (day * 24 * 60) - (hour * 60);
second = Math.floor(intDiff) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
}
if (minute <= 9) minute = '0' + minute;
if (second <= 9) second = '0' + second;
that.detailsForm.time_surplus--; //总秒数减减
that.second = second;
that.minute = minute;
console.log(day, hour, minute, second, '44444444');
}, 1000);
vue商品倒计时demo效果(整理)
猜你喜欢
转载自blog.csdn.net/qq_38881495/article/details/128669286
今日推荐
周排行