actionsheet.wxml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. {{item.type}}
  31. <block wx:for="{{actionItem}}" wx:key="value" wx:for-index="actionIndex">
  32. <button wx:if="{{item.share}}" class="btn weui-actionsheet__cell {{item.type === 'warn' ? 'weui-actionsheet__cell_warn' : '' }}" open-type="share">{{item.text}}</button>
  33. <view
  34. wx:else
  35. class="weui-actionsheet__cell {{item.type === 'warn' ? 'weui-actionsheet__cell_warn' : '' }}"
  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. </block>
  45. <slot name="{{actionItem}}" wx:else></slot>
  46. </view>
  47. <!-- 取消按钮 -->
  48. <view class="weui-actionsheet__action" wx:if="{{showCancel}}">
  49. <view class="weui-actionsheet__cell" data-type="close" id="iosActionsheetCancel" bindtap="closeActionSheet">{{cancelText}}</view>
  50. </view>
  51. </view>