WebApp【公共组件库】@前端(For Git Submodule)
Tevin
2021-04-02 15f5cd79443f8ed4c1097a2443e9b625919da3fc
plugins/infiniteScroll/CInfiniteScroll.vue
@@ -126,12 +126,13 @@
            // 开始加载
            this.inital = true;
            this.loading = true;
            setTimeout(() => {
            this.onLoadMore({
                current: this.current,
                next: this.current + 1,
                // 加载成功
                success: options => {
                    setTimeout(() => {
                        this.$nextTick(() => {
                        this.loading = false;
                        // 没有数据
                        if (!options.pageTotal || options.pageTotal <= 0) {
@@ -146,19 +147,19 @@
                                this.ending = true;
                            }
                        }
                        // 还原下拉
                            // 如果下拉刷新,还原下拉
                        if (this.touch.dargState === 2) {
                            this.touch.driftTop = 0;
                            setTimeout(() => {
                                this.touch.dargState = 0;
                            }, 300);
                        }
                    }, 100);
                        });
                },
                // 加载失败
                fail: () => {
                    this.loading = false;
                    // 还原下拉
                        // 如果下拉刷新,还原下拉
                    if (this.touch.dargState === 2) {
                        this.touch.driftTop = 0;
                        setTimeout(() => {
@@ -167,6 +168,7 @@
                    }
                },
            });
            }, 100);
        },
        onScroll(evt) {
            // 已经滚动(滚动后禁止下拉刷新)
@@ -195,14 +197,6 @@
        // 小程序中滚动到底部
        onScrollToLower() {
            if (process.env.TARO_ENV !== 'weapp') {
                return;
            }
            this.hanldeLoadMore();
        },
        // 初始加载
        initScroll() {
            // 已初始化,跳过
            if (this.inital) {
                return;
            }
            this.hanldeLoadMore();
@@ -292,7 +286,16 @@
                }
            }
        },
        refresh() {
        // 初始加载
        $initScroll() {
            // 已初始化,跳过
            if (this.inital) {
                return;
            }
            this.hanldeLoadMore();
        },
        // 刷新加载
        $refresh() {
            this.ending = false;
            this.current = 0;
            this.hanldeLoadMore();