index.wxml 1.3 KB

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