this.data.list1[this.data.tag].forEach((item,index)=>{
wx.createIntersectionObserver().relativeToViewport({bottom:0}).observe('#item' + index, (res) => {
if (res.boundingClientRect.top > 0) {
let current=index;
if(res.intersectionRatio==0){
current = current - 1
}
this.data.postids.push(this.data.list1[this.data.tag][current].id);
}
})
})
这要监听所有的元素,感觉有些消耗性能,但是可以实现监听