就是想把list的time字段用getTimeLeft处理成想要的格式下面这样试了好像没有变化list:[{name:'aaa',time:1568799262000},{name:'bbb',time:1568797462000},{name:'ccc',time:1568797262000}],constutil=require('../../../utils/util.js')this.data.list.map((res)=>{this.setData({'res.time':util.getTimeLeft(res.time)})})functiongetTimeLeft(datetimeTo){lettime1=newDate(datetimeTo).getTime();lettime2=newDate().getTime();letmss=time1-time2;lethours=parseInt(mss/(1000*60*60));letminutes=parseInt((mss%(1000*60*60))/(1000*60));letseconds=parseInt((mss%(1000*60))/1000);returnhours+"时"+minutes+"分"}
饮歌长啸
相关分类