dialog.wxml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <import src="../common/template/button.wxml" />
  2. <import src="../common/template/icon.wxml" />
  3. <wxs src="../common/utils.wxs" module="_" />
  4. <wxs src="./dialog.wxs" module="this" />
  5. <t-popup
  6. name="dialog"
  7. style="{{_._style([style, customStyle])}}"
  8. t-class="{{classPrefix}}__wrapper"
  9. visible="{{visible}}"
  10. showOverlay="{{showOverlay}}"
  11. closeOnOverlayClick="{{closeOnOverlayClick}}"
  12. preventScrollThrough="{{preventScrollThrough}}"
  13. overlayProps="{{overlayProps}}"
  14. zIndex="{{zIndex}}"
  15. placement="center"
  16. bind:visible-change="overlayClick"
  17. >
  18. <view slot="content" class="{{classPrefix}} {{prefix}}-class">
  19. <slot name="top" />
  20. <view wx:if="{{closeBtn}}" class="{{classPrefix}}__close-btn" bind:tap="onClose">
  21. <template wx:if="{{_.isObject(closeBtn)}}" is="icon" data="{{ name: 'close', size: 22, ...closeBtn }}" />
  22. <t-icon wx:else name="close" size="22" />
  23. </view>
  24. <view class="{{classPrefix}}__content {{prefix}}-class-content">
  25. <view wx:if="{{title}}" class="{{classPrefix}}__header">{{title}}</view>
  26. <slot name="title" />
  27. <view wx:if="{{content}}" class="{{classPrefix}}__body">
  28. <text class="{{classPrefix}}__body-text">{{content}}</text>
  29. </view>
  30. <slot name="content" />
  31. </view>
  32. <slot name="middle" />
  33. <view
  34. class="{{_.cls(classPrefix + '__footer', [['column', buttonLayout === 'vertical'], ['full', buttonVariant == 'text' && actions.length == 0]])}}"
  35. >
  36. <block wx:if="{{actions}}">
  37. <block wx:for="{{actions}}" wx:key="index">
  38. <template
  39. is="button"
  40. data="{{block: true, type: 'action', extra: index, externalClass: prefix + '-class-action', class: this.getActionClass(classPrefix, buttonLayout), ...item }}"
  41. />
  42. </block>
  43. </block>
  44. <slot name="actions" />
  45. <block wx:if="{{_cancel}}">
  46. <template is="button" data="{{type: 'cancel', ..._cancel }}" />
  47. </block>
  48. <slot name="cancel-btn" />
  49. <block wx:if="{{_confirm}}">
  50. <template is="button" data="{{type: 'confirm', theme: 'primary', ..._confirm}}" />
  51. </block>
  52. <slot name="confirm-btn" />
  53. </view>
  54. </view>
  55. </t-popup>