浏览代码

轮播图组件添加如果为空,是否占高控件

xiaohaizhao 1 年之前
父节点
当前提交
d13b7609eb
共有 3 个文件被更改,包括 23 次插入16 次删除
  1. 21 14
      components/slideshow.vue
  2. 1 1
      pages/index/cloud/dataBank.vue
  3. 1 1
      pages/index/cloud/school.vue

+ 21 - 14
components/slideshow.vue

@@ -1,18 +1,21 @@
 <template>
-    <view v-if="list.length">
-        <swiper :style="{
-            width: tovw(width),
-            height: tovw(height),
-        }" :autoplay="autoplay" :interval="interval" circular>
-            <swiper-item class="swiper-item" v-for="(item, index) in list" :key="item.list">
-                <u--image @click="onClick(index)" :src="item.cover" :width="tovw(width)" :height="tovw(height)"
-                    mode="aspectFill" :lazy-load="true">
-                    <template v-slot:loading>
-                        <u-loading-icon color="red"></u-loading-icon>
-                    </template>
-                </u--image>
-            </swiper-item>
-        </swiper>
+    <view>
+        <view v-if="list.length">
+            <swiper :style="{
+                width: tovw(width),
+                height: tovw(height),
+            }" :autoplay="autoplay" :interval="interval" circular>
+                <swiper-item class="swiper-item" v-for="(item, index) in list" :key="item.list">
+                    <u--image @click="onClick(index)" :src="item.cover" :width="tovw(width)" :height="tovw(height)"
+                        mode="aspectFill" :lazy-load="true">
+                        <template v-slot:loading>
+                            <u-loading-icon color="red"></u-loading-icon>
+                        </template>
+                    </u--image>
+                </swiper-item>
+            </swiper>
+        </view>
+        <view style="height: 10px;" v-else-if="empty" />
     </view>
 </template>
 
@@ -29,6 +32,10 @@ export default {
         interval: {
             type: [Number, String],
             default: 5000
+        },
+        empty: {
+            type: Boolean,
+            default: false
         }
     },
     data() {

+ 1 - 1
pages/index/cloud/dataBank.vue

@@ -1,6 +1,6 @@
 <template>
     <My_listbox ref="List" @getlist="getList" :isShowEmpty="false" :bottomHeight="70">
-        <slideshow ref="slideshow" />
+        <slideshow ref="slideshow" empty />
         <view class="box">
             <view class="head" />
             <view v-if="affiches.length" class="affiche">

+ 1 - 1
pages/index/cloud/school.vue

@@ -1,6 +1,6 @@
 <template>
     <My_listbox ref="List" @getlist="getList" :isShowEmpty="false" :bottomHeight="70">
-        <slideshow ref="slideshow" />
+        <slideshow ref="slideshow" empty />
         <view class="box">
             <view class="head" />
             <navigator class="nav-box" v-for="item in list" :key="item.sat_courseware_classid"