props: {
auctionList: {
type: Array,
default: function() {
return [];
}
}
},
onReady() {
this.initList()
},
mounted(){
this.auctionLists1 = this.auctionList;
this.$set(this,'auctionLists1', this.auctionList);
console.log(this.auctionLists1,'++++++++++++++++++++++++++')
},
initList(){
setInterval(()=>{
this.auctionLists1.forEach((item,index)=>{
let _h = item.lastTime.split(':')[0] || 0;
let _m = item.lastTime.split(':')[1] || 0;
let _s = item.lastTime.split(':')[2] || 0;
let time = '';
console.log(111111111)
_s--;
if(_s == -1){
_m--;
_s = 59;
}
if(_m == -1){
_h--;
_m = 59;
}
let _b = ((_h == 0) &&(_m == 0)&&(_s == 0))
if(_s<10){
_s = '0'+parseInt(_s);
}
if(_m<10){
_m = '0'+parseInt(_m);
}
if(_h<10){
_h = '0'+parseInt(_h);
}
if(_b){
time = '活动结束'
//clearTimeout(_t)
}else{
time = _h+':'+_m+':'+_s;
}
console.log(time)
item.lastTime = time;
})
}, 1000)
setInterval(()=>{
this.$set(this,'auctionLists1', this.auctionLists1);
}, 1000)
return;
}