index.wxml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <view class="i-swipeout-wrap i-class">
  2. <view class="i-swipeout-item" bindtouchstart="handlerTouchstart" bindtouchmove="handlerTouchmove" bindtouchend="handlerTouchend" style="{{parse.setPosition(position)}}">
  3. <view class="i-swipeout-content">
  4. <slot name="content"></slot>
  5. </view>
  6. <view class="i-swipeout-button-right-group"
  7. wx:if="{{actions.length > 0}}"
  8. catchtouchend="loop" >
  9. <view class="i-swipeout-button-right-item"
  10. wx:for="{{actions}}"
  11. style="{{parse.setStyle(item)}};width:{{item.width}}px;"
  12. wx:key="{{index}}"
  13. data-index="{{index}}"
  14. bind:tap="handlerButton">
  15. <i-icon
  16. wx:if="{{item.icon}}"
  17. type="{{item.icon}}"
  18. size="{{item.fontsize}}"
  19. color="{{item.color}}">
  20. </i-icon>
  21. {{item.name}}
  22. </view>
  23. </view>
  24. <view class="i-swipeout-button-right-group" catchtouchend="loop" bind:tap="handlerParentButton" wx:if="{{actions.length === 0}}" style="width:{{operateWidth}}px;right:-{{operateWidth}}px;">
  25. <slot name="button"></slot>
  26. </view>
  27. </view>
  28. </view>
  29. <wxs module="parse">
  30. module.exports = {
  31. setStyle : function( item ){
  32. var defaults = '#f7f7f7';
  33. return 'background:' + ( item.background ? item.background : defaults ) +';' + 'color:'+ item.color;
  34. },
  35. setPosition : function( position ){
  36. return 'transform:translate(' + position.pageX + 'px,0);';
  37. }
  38. }
  39. </wxs>