index.wxml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <wxs module="utils" src="../wxs/utils.wxs"/>
  2. <wxs module="style" src="../wxs/style.wxs"/>
  3. <view
  4. bind:tap="onClick"
  5. class="custom-class {{ utils.bem('slider', { disabled, vertical }) }}"
  6. style="{{ wrapperStyle }}"
  7. >
  8. <view
  9. class="{{ utils.bem('slider__bar') }}"
  10. style="{{ barStyle }}; {{ style({ backgroundColor: activeColor }) }}"
  11. >
  12. <view
  13. bind:touchcancel="onTouchEnd"
  14. bind:touchend="onTouchEnd"
  15. bind:touchstart="onTouchStart"
  16. catch:touchmove="onTouchMove"
  17. class="{{ utils.bem('slider__button-wrapper-left') }}"
  18. data-index="{{ 0 }}"
  19. wx:if="{{ range }}"
  20. >
  21. <slot
  22. name="left-button"
  23. wx:if="{{ useButtonSlot }}"
  24. />
  25. <view
  26. class="{{ utils.bem('slider__button') }}"
  27. wx:else
  28. />
  29. </view>
  30. <view
  31. bind:touchcancel="onTouchEnd"
  32. bind:touchend="onTouchEnd"
  33. bind:touchstart="onTouchStart"
  34. catch:touchmove="onTouchMove"
  35. class="{{ utils.bem('slider__button-wrapper-right') }}"
  36. data-index="{{ 1 }}"
  37. wx:if="{{ range }}"
  38. >
  39. <slot
  40. name="right-button"
  41. wx:if="{{ useButtonSlot }}"
  42. />
  43. <view
  44. class="{{ utils.bem('slider__button') }}"
  45. wx:else
  46. />
  47. </view>
  48. <view
  49. bind:touchcancel="onTouchEnd"
  50. bind:touchend="onTouchEnd"
  51. bind:touchstart="onTouchStart"
  52. catch:touchmove="onTouchMove"
  53. class="{{ utils.bem('slider__button-wrapper') }}"
  54. wx:if="{{ !range }}"
  55. >
  56. <slot
  57. name="button"
  58. wx:if="{{ useButtonSlot }}"
  59. />
  60. <view
  61. class="{{ utils.bem('slider__button') }}"
  62. wx:else
  63. />
  64. </view>
  65. </view>
  66. </view>