index.wxml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <wxs src="../wxs/utils.wxs" module="utils" />
  2. <van-popup
  3. show="{{ show }}"
  4. position="bottom"
  5. z-index="{{ zIndex }}"
  6. overlay="{{ overlay }}"
  7. custom-style="{{ customStyle }}"
  8. overlay-style="{{ overlayStyle }}"
  9. custom-class="van-action-sheet"
  10. safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
  11. close-on-click-overlay="{{ closeOnClickOverlay }}"
  12. bind:close="onClose"
  13. >
  14. <view wx:if="{{ title }}" class="van-hairline--bottom van-action-sheet__header">
  15. {{ title }}
  16. <van-icon
  17. name="close"
  18. custom-class="van-action-sheet__close"
  19. bind:click="onClose"
  20. />
  21. </view>
  22. <view wx:if="{{ actions && actions.length }}">
  23. <!-- button外包一层view,防止actions动态变化,导致渲染时button被打散 -->
  24. <button
  25. wx:for="{{ actions }}"
  26. wx:key="index"
  27. open-type="{{ item.openType }}"
  28. class="{{ utils.bem('action-sheet__item', { disabled: item.disabled || item.loading }) }} van-hairline--top {{ item.className || '' }}"
  29. hover-class="van-action-sheet__item--hover"
  30. data-index="{{ index }}"
  31. bind:tap="onSelect"
  32. >
  33. <block wx:if="{{ !item.loading }}">
  34. {{ item.name }}
  35. <text wx:if="{{ item.subname }}" class="van-action-sheet__subname" >{{ item.subname }}</text>
  36. </block>
  37. <van-loading wx:else size="20px" />
  38. </button>
  39. </view>
  40. <slot />
  41. <view
  42. wx:if="{{ cancelText }}"
  43. class="van-action-sheet__cancel"
  44. hover-class="van-action-sheet__cancel--hover"
  45. hover-stay-time="70"
  46. bind:tap="onCancel"
  47. >
  48. {{ cancelText }}
  49. </view>
  50. </van-popup>