From bde60a4ab1c176bef2f15a36b5e355708a4a1939 Mon Sep 17 00:00:00 2001
From: Tevin <tingquanren@163.com>
Date: Mon, 21 Dec 2020 15:11:18 +0800
Subject: [PATCH] 微调无限滚动显示

---
 plugins/infiniteScroll/cInfiniteScroll.scss |   15 +++++++++++----
 forms/imagePicker/CImagePicker.vue          |    2 --
 plugins/infiniteScroll/CInfiniteScroll.vue  |   38 ++++++++++++++++++++++----------------
 3 files changed, 33 insertions(+), 22 deletions(-)

diff --git a/forms/imagePicker/CImagePicker.vue b/forms/imagePicker/CImagePicker.vue
index 0e32565..2bd289e 100644
--- a/forms/imagePicker/CImagePicker.vue
+++ b/forms/imagePicker/CImagePicker.vue
@@ -74,8 +74,6 @@
     },
     methods: {
         handleChange(files, operationType, index) {
-            if (operationType === 'add') {
-            }
             const value = [];
             files.forEach((file) => {
                 if (file.type === 'btn') {
diff --git a/plugins/infiniteScroll/CInfiniteScroll.vue b/plugins/infiniteScroll/CInfiniteScroll.vue
index b66a703..b366640 100644
--- a/plugins/infiniteScroll/CInfiniteScroll.vue
+++ b/plugins/infiniteScroll/CInfiniteScroll.vue
@@ -10,10 +10,16 @@
         @scroll="evt=>onScroll(evt)"
     >
         <slot />
-        <view class="bottom">
-            <view v-if="loading">加载中,请稍后...</view>
+        <view class="c-infinite-bottom">
+            <view
+                class="loading"
+                v-if="loading"
+            >加载中,请稍后...</view>
             <view v-if="ending">
-                <text v-if="pageTatal > 0">-- 没有更多了 --</text>
+                <text
+                    class="ended"
+                    v-if="pageTotal > 0"
+                >-- 没有更多了 --</text>
                 <text
                     class="empty"
                     v-else
@@ -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);
                 },
                 // 加载失败
diff --git a/plugins/infiniteScroll/cInfiniteScroll.scss b/plugins/infiniteScroll/cInfiniteScroll.scss
index 81f7b9c..dc08e43 100644
--- a/plugins/infiniteScroll/cInfiniteScroll.scss
+++ b/plugins/infiniteScroll/cInfiniteScroll.scss
@@ -6,11 +6,18 @@
 @import "../../common/sassMixin";
 
 .c-infinite-scroll {
-    .bottom {
-        height: 1.8rem;
+    .c-infinite-bottom {
         text-align: center;
-        line-height: 1.5rem;
-        color: #666;
+        .loading {
+            height: 2rem;
+            color: #666;
+            line-height: 1.8rem;
+        }
+        .ended {
+            height: 2rem;
+            color: #999;
+            line-height: 1.8rem;
+        }
         .empty {
             line-height: 5rem;
             color: #999;

--
Gitblit v1.9.1