WebApp【公共组件库】@前端(For Git Submodule)
Tevin
2021-01-12 d3d512edc50ac9a9caf8ddb395997642baf1c3f2
plugins/infiniteScroll/CInfiniteScroll.vue
@@ -10,12 +10,18 @@
        @scroll="evt=>onScroll(evt)"
    >
        <slot />
        <view class="bottom">
            <view v-if="loading">加载中,请稍后...</view>
        <view class="c-infinite-bottom">
            <view
                class="c-infinite-loading"
                v-if="loading"
            >加载中,请稍后...</view>
            <view v-if="ending">
                <text v-if="pageTatal > 0">-- 没有更多了 --</text>
                <text
                    class="empty"
                    class="c-infinite-ended"
                    v-if="pageTotal > 0"
                >-- 没有更多了 --</text>
                <text
                    class="c-infinite-empty"
                    v-else
                >暂无数据...</text>
            </view>
@@ -68,21 +74,21 @@
                next: this.current + 1,
                // 加载成功
                success: (options) => {
                    // 没有数据
                    if (!options.pageTotal || options.pageTotal <= 0) {
                        this.ending = true;
                    }
                    // 有数据
                    else {
                        this.pageTotal = options.pageTotal;
                        this.current = this.current + 1;
                        // 已到最后一页
                        if (this.current >= this.pageTotal) {
                            this.ending = true;
                        }
                    }
                    setTimeout(() => {
                        this.loading = false;
                        // 没有数据
                        if (!options.pageTotal || options.pageTotal <= 0) {
                            this.ending = true;
                        }
                        // 有数据
                        else {
                            this.pageTotal = options.pageTotal;
                            this.current = this.current + 1;
                            // 已到最后一页
                            if (this.current >= this.pageTotal) {
                                this.ending = true;
                            }
                        }
                    }, 100);
                },
                // 加载失败