Преглед изворни кода

添加底部高度,是否显示空状态

xiaohaizhao пре 1 година
родитељ
комит
0c135a6d33
1 измењених фајлова са 13 додато и 5 уклоњено
  1. 13 5
      components/My_listbox.vue

+ 13 - 5
components/My_listbox.vue

@@ -2,9 +2,9 @@
     <view class="container" :style="{ background: boxBackground }">
         <view id="mylisttop" />
         <scroll-view class="scroll-view" scroll-y :refresher-enabled='pullDown' :refresher-triggered='inRefresh'
-            :style="{ height: (defaultHeight - 0 || height - 0) + 'px' }" :triggered='true' @refresherrefresh='pullToRefresh'
-            :scroll-into-view="scrollIntoView" :lower-threshold='300' :scroll-with-animation="true"
-            @scrolltolower='loadThePage'>
+            :style="{ height: (defaultHeight - 0 || height - 0) + 'px' }" :triggered='true'
+            @refresherrefresh='pullToRefresh' :scroll-into-view="scrollIntoView" :lower-threshold='300'
+            :scroll-with-animation="true" @scrolltolower='loadThePage'>
             <view id="header">
                 <slot />
             </view>
@@ -17,6 +17,7 @@
                 {{ pagingText }}
             </view>
             <u-divider v-if="bottomTips" text="已经到底部" :dashed="true"></u-divider>
+            <view v-if="bottomHeight" :style="{ height: tovw(bottomHeight) }" />
         </scroll-view>
     </view>
 </template>
@@ -49,6 +50,14 @@ export default {
         defaultHeight: {
             type: [String, Number],
             default: 0
+        },
+        isShowEmpty: {
+            type: Boolean,
+            default: true
+        },
+        bottomHeight: {
+            type: [Number, String],
+            default: 0
         }
     },
     data() {
@@ -95,7 +104,6 @@ export default {
                             height = res - num;
                             break;
                     }
-                    console.log("高度", height)
                     if (this.height != height) this.height = height;
                     resolve(height)
                 });
@@ -107,7 +115,7 @@ export default {
             content.pageTotal = res.pageTotal;
             // this.pagingText = content.pageNumber + ' / ' + content.pageTotal;
             this.bottomTips = res.total != 0 && content.pageNumber >= content.pageTotal;
-            this.empty = res.total == 0;
+            if (this.isShowEmpty) this.empty = res.total == 0;
             return content;
         }
     },