actionsheet.wxml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. wx:key="actionIndex"
  33. wx:for="{{actionItem}}"
  34. wx:for-index="actionIndex"
  35. data-groupindex="{{index}}"
  36. data-index="{{actionIndex}}"
  37. data-value="{{item.value}}"
  38. bindtap="buttonTap"
  39. >
  40. {{item.text}}
  41. </view>
  42. </block>
  43. <slot name="{{actionItem}}" wx:else></slot>
  44. </view>
  45. <!-- 取消按钮 -->
  46. <view class="weui-actionsheet__action" wx:if="{{showCancel}}">
  47. <view class="weui-actionsheet__cell" data-type="close" id="iosActionsheetCancel" bindtap="closeActionSheet">{{cancelText}}</view>
  48. </view>
  49. </view>