layui.use(['layer','util'],function () {标签:countdown,layer,layui,serverTime,util,date,var From: https://www.cnblogs.com/luqiangblogs/p/17034285.html
var layer = layui.layer,util=layui.util;
//弹框倒计时操作
layer.open({
type: 1,
title: '处理中.....',
shadeClose: true,
skin:'code',
area: ['300px', '200px'],
content: "<a id='time1'></a>"
});
// var endTime = new Date(2024,1,1).getTime()
// ,serverTime = new Date().getTime();
// console.log(endTime,serverTime);
var mydate = new Date();
var endTime = parseInt(mydate.getMilliseconds() + 30000);
var serverTime = mydate.getMilliseconds()
//util.countdown 第一个参数是结束时间,第二个是开始时间(单位:毫秒)
util.countdown(endTime, serverTime, function(date,serverTime,timer){
console.log(date);
// var str = date[0] + '天' + date[1] + '时' + date[2] + '分' + date[3]+'秒';
$('#time1').html(date[3]+'秒');
});
})