This commit is contained in:
quantulr
2023-08-30 17:27:21 +08:00
commit 0288146b0d
85 changed files with 26508 additions and 0 deletions

View File

@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@ -0,0 +1 @@
/* components/infinite-scroll/index.wxss */

View File

@ -0,0 +1,44 @@
// components/infinite-scroll/index.ts
Component({
/**
* 组件的属性列表
*/
properties: {},
/**
* 组件的初始数据
*/
data: {},
/**
* 组件的方法列表
*/
methods: {},
lifetimes: {
attached() {
//@ts-ignore
this._observer = wx.createIntersectionObserver(this);
//@ts-ignore
this._observer
// .createIntersectionObserver()
.relativeToViewport({ bottom: 100 })
.observe(".load-more", (res: any) => {
console.log(res);
res.intersectionRatio; // 相交区域占目标节点的布局区域的比例
res.intersectionRect; // 相交区域
res.intersectionRect.left; // 相交区域的左边界坐标
res.intersectionRect.top; // 相交区域的上边界坐标
res.intersectionRect.width; // 相交区域的宽度
res.intersectionRect.height; // 相交区域的高度
});
// //@ts-ignore
// this._observer = wx.createIntersectionObserver(this);
// //@ts-ignore
// this._observer.relativeTo(".scroll-view").observe(".load-more", (res) => {
// console.log("到底了");
// this.triggerEvent("loadmore", {}, {});
// });
},
},
});

View File

@ -0,0 +1,5 @@
<!--components/infinite-scroll/index.wxml-->
<view>
<slot></slot>
<view class="load-more">load more</view>
</view>