cshenfu
2024-06-27 58aa6e282bb343503be3cb198948328ea3ed7b79
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// [z-paging]使用页面滚动时引入此mixin,用于监听和处理onPullDownRefresh等页面生命周期方法
 
const ZPagingMixin = {
    onPullDownRefresh() {
        if (this.isPagingRefNotFound()) return;
        this.$refs.paging.reload();
    },
    onPageScroll(e) {
        if (this.isPagingRefNotFound()) return;
        this.$refs.paging.updatePageScrollTop(e.scrollTop);
        if (e.scrollTop < 10) {
            this.$refs.paging.doChatRecordLoadMore();
        }
    },
    onReachBottom() {
        if (this.isPagingRefNotFound()) return;
        this.$refs.paging.doLoadMore();
    },
    methods: {
        isPagingRefNotFound() {
            return !this.$refs.paging || this.$refs.paging === undefined;
        }
    }
}
 
export default ZPagingMixin;