index.wxml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <wxs
  2. src="./index.wxs"
  3. module="util" />
  4. <view class="ant-swipe">
  5. <view
  6. class="ant-swipe-action"
  7. style="width: {{ util.getWidth(rightWidth, leftWidth, inertiaWidth) }};">
  8. <movable-area
  9. wx:if="{{ ready }}"
  10. class="ant-swipe-action-movable"
  11. style="margin-left: {{ util.getMarginLeft(rightWidth, leftWidth, inertiaWidth) }}">
  12. <movable-view
  13. class="ant-swipe-action-movable-content"
  14. style="width:{{ util.getWidth2(rightWidth, leftWidth, inertiaWidth) }}; margin-left: {{ util.getMarginLeft2(rightWidth, leftWidth, inertiaWidth) }};"
  15. x="{{ swipeX }}"
  16. data-type="content"
  17. animation="{{ animation }}"
  18. damping="{{ damping }}"
  19. direction="horizontal"
  20. out-of-bounds="{{ false }}"
  21. disabled="{{ disabled }}"
  22. bind:tap="onSwipeTap"
  23. bindchange="onChange"
  24. bindchangeend="onChangeEnd"
  25. catch:touchend="onTouchEnd"
  26. bind:touchcancel="onTouchCancel"
  27. catch:touchstart="onTouchStart">
  28. <view
  29. class="ant-swipe-action-movable-content-view"
  30. style="{{ util.getSlotWidthStyle(rightWidth, leftWidth, _leftButtons, _rightButtons, inertiaWidth) }}"
  31. bind:tap="onClick">
  32. <view
  33. wx:if="{{ swipedR || swipedL }}"
  34. class="ant-swipe-action-movable-content-view-modal" />
  35. <slot />
  36. </view>
  37. </movable-view>
  38. <movable-view
  39. class="ant-swipe-action-movable-content ant-swipe-action-movable-right{{ $id ? '-' + $id : '' }}"
  40. wx:for="{{ _rightButtons }}"
  41. wx:for-item="item"
  42. wx:for-index="idx"
  43. damping="{{ damping }}"
  44. wx:key="{{ idx }}"
  45. style="{{ util.getRightMovableContentStyle(tapTypeR, idx, rightWidth, leftWidth, inertiaWidth) }}"
  46. data-type="content"
  47. animation="{{ false }}"
  48. disabled="{{ true }}"
  49. direction="horizontal"
  50. x="{{ moveX * (util.getMoveX(_rightButtons, idx) / rightWidth) }}">
  51. <view
  52. class="ant-swipe-action-movable-content-right"
  53. style="background: {{ item.bgColor }};width: {{ (item.width + inertiaWidth + 1) / 2 }}px;">
  54. <view
  55. class="ant-swipe-action-movable-content-right-text"
  56. bind:tap="onItemTap"
  57. data-item="{{ util.axmlObj({ item, idx }) }}"
  58. aria-hidden="{{ !swipedR }}"
  59. style="{{ util.getMovableContentRightStyle(item, tapTypeR, idx, rightWidth, inTouch, inertiaWidth, myStyle) }}">
  60. <!-- display: inline -->
  61. <text
  62. class="right-text {{ util.getLeft(tapTypeR, idx, _rightButtons, true) }}"
  63. >{{ util.getRightText(tapTypeR, idx, item) }}</text
  64. >
  65. </view>
  66. </view>
  67. </movable-view>
  68. <movable-view
  69. class="ant-swipe-action-movable-content ant-swipe-action-is-right-swipe ant-swipe-action-movable-left{{ $id ? '-' + $id : '' }}"
  70. wx:for="{{ _leftButtons }}"
  71. wx:for-item="itemL"
  72. wx:for-index="idx"
  73. wx:key="left-{{ idx }}"
  74. damping="{{ damping }}"
  75. style="{{ util.getLeftMovableContentStyle(tapTypeL, idx, leftWidth, inertiaWidth) }}"
  76. data-type="content"
  77. animation="{{ false }}"
  78. disabled="{{ true }}"
  79. direction="horizontal"
  80. x="{{ moveX * (util.getMoveX(_leftButtons, idx) / leftWidth) }}">
  81. <view
  82. class="ant-swipe-action-movable-content-left"
  83. style="background: {{ tapTypeL && tapTypeL === 'L-' + idx && _leftButtons.length === 3 && idx === 1 ? 'none' : itemL.bgColor }};width: {{ (leftWidth + inertiaWidth) / 2 }}px">
  84. <view
  85. class="ant-swipe-action-movable-content-left-text1 ant-swipe-action-left"
  86. bind:tap="onItemTap"
  87. data-item="{{ util.axmlObj({ itemL, idx }) }}"
  88. aria-hidden="{{ !swipedL }}"
  89. style="{{ util.getMovableContentLeftStyle(itemL, tapTypeL, idx, leftWidth, inTouch, inertiaWidth, myStyle) }}">
  90. <!-- display: inline -->
  91. <text
  92. class="right-text"
  93. style="width: 100%"
  94. ><!-- display: inline -->
  95. <text
  96. class="right-text {{ util.getLeft(tapTypeL, idx, _leftButtons, false) }}"
  97. >{{ util.getLeftText(tapTypeL, idx, itemL) }}</text
  98. ></text
  99. >
  100. </view>
  101. </view>
  102. </movable-view>
  103. </movable-area>
  104. </view>
  105. </view>