收藏
回答

IOS端swiper组件切换current>0后面的swiper-item不显示,安卓无此问题。?

<view class="swiper_cont">
    <swiper indicator-dots="{{false}}" current="{{currentIndex}}" autoplay="{{false}}" previous-margin="46rpx" next-margin="46rpx" bindchange="handdleSwiper" style=" height: 463rpx;">
      <swiper-item style="height: 403rpx;" wx:for="{{cardList}}" wx:key="{{item.scardid}}">
        <view class="card {{currentIndex === index ? '' : 'card_s'}}" style=" background: url({{cdnPath}}img/myOilCard/bg.png) no-repeat; background-size: 100% 100%; margin: 71rpx auto 0 auto;" wx:if="{{item.scardid}}">
          <!--  -->
          <view class="info">
            <view class="cardName">
              <image src="{{cdnPath}}img/myOilCard/cardLogo.png" alt mode="widthFix" class="img"></image>
              <text>中石化友途加油卡</text>
            </view>
            <view class="h1">{{item.scardid}}</view>
            <view class="p">持卡人:{{item.owner}}</view>
            <view class="type" wx:if="{{item.cardType === '3' || item.cardType === '4'}}" style=" background: url({{cdnPath}}img/myOilCard/typeBg.png) no-repeat; background-size: 100% 100%;">
              <text wx:if="{{item.cardType === '3'}}">主卡</text>
              <text wx:elif="{{item.cardType === '4'}}">副卡</text>
              <text wx:elif="{{item.cardType === '1'}}">待校验</text>
              <text wx:elif="{{item.cardType === '2'}}">卡号错误</text>
            </view>
            <view class="deletBtn" data-item="{{item}}" bindtap="deletCard">
              <text>删除此卡</text>
            </view>
          </view>
        </view>
        <view class="card {{currentIndex === index ? '' : 'card_s'}}" bindtap="addOilNewCard" style=" background: url({{cdnPath}}img/myOilCard/bg.png) no-repeat; background-size: 100% 100%; margin: 71rpx auto 0 auto;" wx:else>
          <!--  -->
          <view class="add">
            <view class="icon">
              <image src="{{cdnPath}}img/myOilCard/add.png" alt mode="widthFix" class="img"></image>
            </view>
            <view class="h1">添加加油卡</view>
          </view>
        </view>
      </swiper-item>
    </swiper>
  </view>

求解,该问题怎么解决。安卓机型测试 华为 VIVO OPPO无问题。苹果测试 6 8 机型 系统13.1.3有这个问题


回答关注问题邀请回答
收藏

1 个回答

  • 卢霄霄
    卢霄霄
    2019-10-30

    swiper-item上不要写style,写到里面的view上

    2019-10-30
    有用
    回复 3
    • Mithrandirヾ
      Mithrandirヾ
      2019-10-30
      那此前的两个版本我也写到item上过。没有此问题。这是新改的规则吗
      2019-10-30
      回复
    • 卢霄霄
      卢霄霄
      2019-10-30回复Mithrandirヾ
      没注意啥时候有的这个问题。。swiper-item的切换效果是用内联样式里的transform做的。。style把组件动态添加的样式覆盖了,所以有问题。。
      2019-10-30
      回复
    • Mithrandirヾ
      Mithrandirヾ
      2019-10-30回复卢霄霄
      谢谢了。我之前的swiper-item样式都是 再命名来强制改变效果
      2019-10-30
      回复
登录 后发表内容
问题标签