<view class="">完结倒计时: {{finishitime}}</view> this.counttime = this.shipments.planLeaveTime this.djs() djs(){ let endtime = new Date(this.counttime) let nowtime = new Date() //当前时间 let lefttime = parseInt((endtime.getTime() - nowtime.getTime()) / 1000) let d = parseInt(lefttime / 3600 / 24) let h = parseInt(lefttime / (60 * 60)) % 24 let m = parseInt(lefttime / (60)) % 60 let s = parseInt(lefttime % 60) if(lefttime<0){ console.log('截止时间已过') } this.finishitime = d+"天"+h+"小时"+m+"分"+s+"秒" // console.log(d+"天"+h+"小时"+m+"分"+s+"秒") }, onShow() { setInterval(() =>{ this.djs() },1000) },