/**
- 图片赖加载
- wx.createIntersectionObserver 创建IntersectionObserver监听对象
- relativeToViewport 距离底部 -10加载下一个, observe 指定目标节点并开始监听相交状态变化情况
- @param start_len 创建节点开始
- @param end_len 创建节点结束
- @param name 渲染数据的对象名称
- @param _this 绑进页对象
*/
function loadImage(start_len, end_len, name, this)
{
setTimeout(function(){
let IntersectionObserver_space = [];
for (let j = start_len; j < end_len; j++) {
IntersectionObserver_space[j] = wx.createIntersectionObserver();
IntersectionObserver_space[j].relativeToViewport({ bottom: -10 }).observe(’#load’ + j, (res) => {
if (res.intersectionRatio > 0) {
var list = name + ‘[’ +j+ ‘].show’;
_this.setData({
[list]: true
})
IntersectionObserver_space[j].disconnect();
}
})
}
},200)
}