swiper height:100% 在苹果手机上不显示
发布于 5 年前 作者 li48 9622 次浏览 来自 问答

wxml:

<view class=“MainContent”>

  <view class=“TopBlock”>

  TopBlick

  </view>

  <view class=“BottomBlock”>

      <swiper>

        <swiper-item class=“swiper-item”>

        <scroll-view scroll-y class=“scroll”>

          <view class=“item” wx:for="{{[1,1,1,1,1,1,1,1]}}">

            <view class=“top”></view>

            <view class=“bottom”></view>

          </view>

        </scroll-view>

        </swiper-item>

      </swiper>

  </view>

</view>

wxss:

page {

    height: 100%;

}

.MainContent {

    display: flex;

    flex-direction: column;

    height: 100%;

    width: 100%;

}

.TopBlock {

    height: 50px;

    background-color: orangered;

}

.BottomBlock {

    /*display: flex;*/

    flex: 1;

    background-color: blanchedalmond;

    overflow-y: auto;

    overflow: auto;

}

swiper {

    width: 100%;

    height: 100%;

    background-color: brown;

}

.swiper-item {

     width: 100%;

    height: 100%;

    background-color: brown;

}

.scroll {

    height: 100%;

    background-color: greenyellow;

}

.item {

    background-color: hotpink;

    margin-bottom: 10px;

}

.top {

    width: 50px;

    height: 50px;

    background-color: ghostwhite;

}

.bottom {

    width: 70px;

    height: 70px;

    background-color: cornflowerblue;

}

2 回复

管理员呢?

swiper 设置能百分比的话苹果手机不显示,模拟器和安卓正常。设置能固定高度所有设备能正常显示。

回到顶部