内容滚动到可视区曝光
nitroge opened this issue · comments
EN... commented
需求:列表内容数据滚动到用户可视区域时,进行数据上报
上代码:
// post-item 内容组件id
const observer = uni.createIntersectionObserver(this).relativeToViewport({
top: 0,
bottom: -100,
});
const { contentMedia } = this.item;
observer.observe('.post-item', res => {
if (res.intersectionRatio) {
// 内容滚动到可视区
}