for循环定时器离开页面无法清除
handleBarrage(data) {
for (let i in data) {
this.pushHandle(i,data)
}
},
pushHandle(i, data){
let setTime = setTimeout(function () {
console.log(i)
doommList.push(dataArr(data[i].title, data[i].logo, Math.ceil(Math.random() * 20 + 3), 10));
page.setData({
dommshow: doommList
})
clearTimeout(setTime)
}, 5000 * i)
},
无法清除定时器,各位知道是什么原因吗,数据会不断叠加