//获取当月天数getData(){let d =newDate();let days =newDate(d.getFullYear(), d.getMonth()+1,0);return days.getDate();},
根据指定时间获取对应的时间差
//获取时间 num 时间差负数时间则往前推正数这往后推 && time为指定时间没有则默认当前时间getBeforeDate(num, time){let n = num;let d ='';if(time){
d =newDate(time);}else{
d =newDate();}// 将传值放进去获得时间戳
d.setDate(d.getDate()- n);let year = d.getFullYear();let mon = d.getMonth()+1;let day = d.getDate();//将时间转为需要的格式 当月和日小于10则在前面添加0let s = year +"-"+(mon <10?('0'+ mon): mon)+"-"+(day <10?('0'+ day): day);//将值return出去return s;},