小程序
小游戏
企业微信
微信支付
扫描小程序码分享
如题 👆
附: 想实现列表项 懒加载+进入可视区过渡动画 的效果, 如果不能使用 IntersectionObserver API , 有什么比较好的其他方案吗?
计算 scrollTop 的方法有点担心性能问题
2 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
支持 IntersectionObserver,但目前只支持相对于 viewport 的(即 scroll-view)。
懒加载+过渡动画,我会建议用 list-builder / grid-builder,这两个长列表组件都是进入可视区域时才创建组件的。
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
const posterObserver = this.createIntersectionObserver({
thresholds: [0.01, 0.99],
initialRatio: 0,
observeAll: true,
nativeMode: true
});
posterObserver.relativeToViewport({
bottom: -30,
top: -30,
posterObserver.observe(this.data.posterSelector, (res: any) => {
console.log(res);// 这里没有回调
})
wx.createIntersectionObserver() 改成 this.createIntersectionObserver()
才能有回调
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
支持 IntersectionObserver,但目前只支持相对于 viewport 的(即 scroll-view)。
懒加载+过渡动画,我会建议用 list-builder / grid-builder,这两个长列表组件都是进入可视区域时才创建组件的。
const posterObserver = this.createIntersectionObserver({thresholds: [0.01, 0.99],initialRatio: 0,observeAll: true,nativeMode: true});posterObserver.relativeToViewport({bottom: -30,top: -30,});posterObserver.observe(this.data.posterSelector, (res: any) => {console.log(res);// 这里没有回调})wx.createIntersectionObserver() 改成 this.createIntersectionObserver()
才能有回调