index.wxml 1.5KB

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