使用cover-image即可

  1. <cover-image src="../../static/rv_img2.jpg"></cover-image>

image.png

设置高度

  1. /*
  2. 设置轮播图高度:height: calc(100vh - 200rpx) !important;
  3. */
  4. .swiper {
  5. width: 90%;
  6. overflow: scroll;
  7. margin: 0 auto;
  8. //这里的200需要自己计算
  9. height: calc(100vh - 200rpx) !important;
  10. }
  1. <swiper class='swiper' bindchange='pagechange' current='{{currentIndex}}'>
  2. <swiper-item class='swiper'>
  3. <include src="../tab1/tab1.wxml" class="record-item"/>
  4. </swiper-item>
  5. <swiper-item class='swiper' class='swiper'>
  6. <include src="../tab2/tab2.wxml" class="record-item"/>
  7. </swiper-item>
  8. <swiper-item class='swiper' class='swiper'>
  9. <include src="../tab3/tab3.wxml" class="record-item"/>
  10. </swiper-item>
  11. </swiper>

效果图
image.png