xcx/components/swipe-action/swipe-action.wxml

(完整代码) 1KB

<view class="tui-swipeout-wrap">
  <view class="tui-swipeout-item  {{isShowBtn?'swipe-action-show':''}}" bindtouchstart="handlerTouchstart" bindtouchmove="handlerTouchmove" bindtouchend="handlerTouchend" style="{{parse.setPosition(position)}}">
    <view class="tui-swipeout-content">
      <slot name="content"></slot>
    </view>
    <view class="tui-swipeout-button-right-group" wx:if="{{actions.length > 0}}" catchtouchend="loop">
      <view class="tui-swipeout-button-right-item" wx:for="{{actions}}" style="{{parse.setStyle(item)}};width:{{item.width}}px;" wx:key="{{index}}" data-index="{{index}}" bindtap="handlerButton">
        <image src="{{item.icon}}" wx:if="{{item.icon}}" style="width:{{item.imgWidth}}rpx;height:{{item.imgHeight}}rpx"></image>
        <text>{{item.name}}</text>
      </view>
    </view>
    <!--actions长度设置为0,可直接传按钮进来-->
    <view class="tui-swipeout-button-right-group" catchtouchend="loop" bind:tap="handlerParentButton" wx:if="{{actions.length === 0}}" style="width:{{operateWidth}}px;right:-{{operateWidth}}px;">
      <slot name="button"></slot>
    </view>
  </view>
  <view wx:if="{{isShowBtn}}" class="swipe-action_mask" bindtap="closeButtonGroup" catchtouchmove="closeButtonGroup" />
</view>
<wxs module="parse">
  module.exports = {
    setStyle: function(item) {
      var defaults = '#f7f7f7';
      return 'background:' + (item.background ? item.background : defaults) + ';' + 'color:' + item.color;
    },
    setPosition: function(position) {
      return 'transform:translate(' + position.pageX + 'px,0);';
    }
  }
</wxs>

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。