cover-view抖动
发布于 5 年前 作者 weihou 12169 次浏览 来自 问答

<block wx:for="{{mapSkuList}}" wx:key=“index”>

<cover-view class=‘sku-content-list active’ wx:if="{{activeBanner == index}}">

<cover-view class=‘img’>

<cover-image class=“image” src=’{{item.img}}’ mode=“aspectFill”></cover-image>

</cover-view>

<cover-view class=‘color active’>{{item.skuColor}}</cover-view>

<cover-view class=‘mashu active’>({{item.skuSize}})</cover-view>

<cover-view class=“sku-content-size-right”>

<cover-view class=“minusIcon active” data-index="{{index}}" wx:key=“index” bindtap=“minusSkuNumber”>-</cover-view>

<cover-view class=“skuNumber active”>{{item.selectNumber}}</cover-view>

<cover-view class=“plusIcon active” wx:key=“index” data-index="{{index}}" bindtap=“plusSkuNumber”>+</cover-view>

</cover-view>

</cover-view>

<cover-view class=‘sku-content-list’ catchtap=“changeBanner” wx:else data-index="{{index}}" data-pic="{{item.price}}" data-suggestedPrice="{{item.suggestedPrice}}" data-num="{{item.stockNumber}}" data-img="{{item.img}}">

<cover-view class=‘img’>

<cover-image class=“image” src=’{{item.img}}’ mode=“aspectFill”></cover-image>

</cover-view>

<cover-view class=‘color’>{{item.skuColor}}</cover-view>

<cover-view class=‘mashu’>({{item.skuSize}})</cover-view>

<cover-view class=“sku-content-size-right”>

<cover-view class=“minusIcon” bindtap=“minusSkuNumber” wx:key=“index” data-index="{{index}}">-</cover-view>

<cover-view class=“skuNumber”>{{item.selectNumber}}</cover-view>

<cover-view class=“plusIcon” bindtap=“plusSkuNumber” wx:key=“index” data-index="{{index}}">+</cover-view>

</cover-view>

</cover-view>

</block>

列表中有视频,考虑到层级问题,就用cover-view标签,sku上绑定的事件catchtap=“changeBanner” 改变sku的背景颜色,bindtap=“plusSkuNumber”,bindtap="minusSkuNumber"数量的加减,点击的时候sku都有很多的抖动,体验感不好,用view标签就不会有这样的情况,这是什么原因?能解决嘛?

2 回复

<cover-view class=“sku-content-block”>

<cover-view class=“sku-content-size-box”>

<cover-view class=“sku-content-size”>

<block wx:for="{{mapSkuList}}" wx:key=“index”>

<cover-view class=‘sku-content-list active’ wx:if="{{activeBanner == index}}">

<cover-view class=‘img’>

<cover-image class=“image” src=’{{item.img}}’ mode=“aspectFill”></cover-image>

</cover-view>

<cover-view class=‘color active’>{{item.skuColor}}</cover-view>

<cover-view class=‘mashu active’>({{item.skuSize}})</cover-view>

<cover-view class=“sku-content-size-right”>

<cover-view class=“minusIcon active” data-index="{{index}}" wx:key=“index” bindtap=“minusSkuNumber”>-</cover-view>

<cover-view class=“skuNumber active”>{{item.selectNumber}}</cover-view>

<cover-view class=“plusIcon active” wx:key=“index” data-index="{{index}}" bindtap=“plusSkuNumber”>+</cover-view>

</cover-view>

</cover-view>

<cover-view class=‘sku-content-list’ catchtap=“changeBanner” wx:else data-index="{{index}}" data-pic="{{item.price}}" data-suggestedPrice="{{item.suggestedPrice}}" data-num="{{item.stockNumber}}" data-img="{{item.img}}">

<cover-view class=‘img’>

<cover-image class=“image” src=’{{item.img}}’ mode=“aspectFill”></cover-image>

</cover-view>

<cover-view class=‘color’>{{item.skuColor}}</cover-view>

<cover-view class=‘mashu’>({{item.skuSize}})</cover-view>

<cover-view class=“sku-content-size-right”>

<cover-view class=“minusIcon” bindtap=“minusSkuNumber” wx:key=“index” data-index="{{index}}">-</cover-view>

<cover-view class=“skuNumber”>{{item.selectNumber}}</cover-view>

<cover-view class=“plusIcon” bindtap=“plusSkuNumber” wx:key=“index” data-index="{{index}}">+</cover-view>

</cover-view>

</cover-view>

</block>

</cover-view>

</cover-view>

</cover-view>

回到顶部