actionsheet.wxml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <wxs module="utils">
  2. var join = function(a,b) {
  3. return a+b
  4. };
  5. var isNotSlot = function(v) {
  6. return typeof v !== 'string'
  7. }
  8. module.exports = {
  9. join: join,
  10. isNotSlot: isNotSlot
  11. }
  12. </wxs>
  13. <view wx:if="{{mask}}" class="weui-mask {{show ? '' : 'weui-mask_hidden'}} {{maskClass}}" bindtap="closeActionSheet"></view>
  14. <view class="weui-actionsheet {{show ? 'weui-actionsheet_toggle' : ''}} {{extClass}}">
  15. <!-- 标题 -->
  16. <block wx:if="{{title}}">
  17. <view class="weui-actionsheet__title">
  18. <view class="weui-actionsheet__title-text">{{title}}</view>
  19. </view>
  20. </block>
  21. <slot name="title" wx:else></slot>
  22. <view
  23. class="{{ !showCancel && index === actions.length-1 ? 'weui-actionsheet__action' : 'weui-actionsheet__menu' }}"
  24. wx:key="index"
  25. wx:for-item="actionItem"
  26. wx:for-index="index"
  27. wx:for="{{actions}}"
  28. >
  29. <block wx:if="{{utils.isNotSlot(actionItem)}}">
  30. <view
  31. class="weui-actionsheet__cell {{item.type === 'warn' ? 'weui-actionsheet__cell_warn' : '' }}"
  32. hover-class="weui-active"
  33. wx:key="actionIndex"
  34. wx:for="{{actionItem}}"
  35. wx:for-index="actionIndex"
  36. data-groupindex="{{index}}"
  37. data-index="{{actionIndex}}"
  38. data-value="{{item.value}}"
  39. bindtap="buttonTap"
  40. >
  41. {{item.text}}
  42. </view>
  43. </block>
  44. <slot name="{{actionItem}}" wx:else></slot>
  45. </view>
  46. <!-- 取消按钮 -->
  47. <view class="weui-actionsheet__action" wx:if="{{showCancel}}">
  48. <view class="weui-actionsheet__cell" hover-class="weui-active" data-type="close" id="iosActionsheetCancel" bindtap="closeActionSheet">{{cancelText}}</view>
  49. </view>
  50. </view>