index.wxml 1.7 KB

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