dialog.wxml 2.2 KB

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