var nowtime = new Date(), //获取当前时间
endtime = new Date("2020/8/8"); //定义结束时间
var lefttime = endtime.getTime() - nowtime.getTime(), //距离结束时间的毫秒数
leftd = Math.floor(lefttime/(1000*60*60*24)), //计算天数
lefth = Math.floor(lefttime/(1000*60*60)%24), //计算小时数
leftm = Math.floor(lefttime/(1000*60)%60), //计算分钟数
lefts = Math.floor(lefttime/1000%60); //计算秒数
this.countdown = leftd + "天" + lefth + ":" + leftm + ":" + lefts; //返回倒计时的字符串
this.day = leftd;//返回天
this.time = lefth;//返回时
this.minute = leftm;//返回分
this.second = lefts;//返回秒
console.log(this.time)