getTime(){
let that = this
var now = new Date(); //获取当前日期 var now 自己定义
var year = now.getFullyear(); //获取获取完整的年份(4位,1970-????)
var month = now.getMonth() + 1; //获取当前月 +1不写的话则是上个月 -1则为上上个月
var day = now.getDate(); //当前日
var hours = now.getHours(); //当前小时
var Min = now.getMinutes(); //当前分钟
var Sec = now.getSeconds(); //获取当前秒数(0-59)
//通过三元运算来补位不足2为添加0 例如 05-06 08:09:01 5月6号8点零9分 01秒
month = month < 10 ? "0" + month : month;
day = day < 10 ? "0" + day : day;
hours = hours < 10 ? '0' + hours : hours;
Min = Min < 10 ? '0' + Min : Min;
Sec = Sec < 10 ? '0' + Sec : Sec;
var time = `${year}-${month}-${day} ${hours}:${Min}:${Sec}`//把当前日期拼接赋值到time中去
var mytime = now.toLocaleTimeString(); //获取当前时间上午XX:XX:XX
var mytim = now.toLocaleString( ); //获取日期与时间 2021/11/29 上午11:14:13
var gday = now.getDay(); //获取当前星期X(0-6,0代表星期天)
let nowDate = new Date(new Date().getTime() - 1 * 24 * 3600 * 1000) //获取前一天的当前时间
},