index.wxml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <wxs
  2. src="./index.wxs"
  3. module="utils" />
  4. <ant-popup
  5. className="ant-modal {{ className || '' }}"
  6. style="{{ style || '' }}"
  7. maskClassName="{{ maskClassName }}"
  8. maskStyle="{{ maskStyle }}"
  9. visible="{{ visible }}"
  10. duration="{{ duration }}"
  11. position="center"
  12. animation="{{ animation }}"
  13. zIndex="{{ zIndex }}"
  14. destroyOnClose="{{ destroyOnClose }}"
  15. bind:close="onMaskClose">
  16. <view
  17. class="ant-modal-body {{ bodyClassName || '' }}"
  18. style="{{ bodyStyle || '' }}">
  19. <slot name="header" />
  20. <view
  21. wx:if="{{ title }}"
  22. class="ant-modal-body-title">
  23. {{ title }}
  24. </view>
  25. <slot
  26. wx:else
  27. name="title" />
  28. <view
  29. wx:if="{{ content }}"
  30. class="ant-modal-body-content">
  31. {{ content }}
  32. </view>
  33. <slot
  34. wx:else
  35. name="content" />
  36. <view
  37. wx:if="{{ type === 'focus' }}"
  38. class="ant-modal-body-footer-focus">
  39. <ant-button
  40. type="primary"
  41. className="ant-modal-body-footer-focus-primary"
  42. style="{{ primaryButtonStyle || '' }}"
  43. bind:tap="onPrimaryButtonTap">
  44. {{ primaryButtonText }}
  45. </ant-button>
  46. <view
  47. wx:if="{{ secondaryButtonText }}"
  48. class="ant-modal-body-footer-focus-secondary"
  49. style="{{ secondaryButtonStyle || '' }}"
  50. bind:tap="onSecondaryButtonTap">
  51. {{ secondaryButtonText }}
  52. </view>
  53. <view
  54. wx:if="{{ cancelButtonText }}"
  55. class="ant-modal-body-footer-focus-cancel"
  56. style="{{ cancelButtonStyle || '' }}"
  57. bind:tap="onCancelButtonTap">
  58. {{ cancelButtonText }}
  59. </view>
  60. </view>
  61. <view
  62. wx:elif="{{ utils.getDirection(primaryButtonText, secondaryButtonText, cancelButtonText, type) === 'horizontal' }}"
  63. class="ant-modal-body-footer-horizontal">
  64. <view
  65. wx:if="{{ cancelButtonText }}"
  66. class="ant-modal-body-footer-horizontal-cancel"
  67. style="{{ cancelButtonStyle || '' }}"
  68. bind:tap="onCancelButtonTap">
  69. {{ cancelButtonText }}
  70. </view>
  71. <view
  72. wx:if="{{ secondaryButtonText }}"
  73. class="ant-modal-body-footer-horizontal-secondary"
  74. style="{{ secondaryButtonStyle || '' }}"
  75. bind:tap="onSecondaryButtonTap">
  76. {{ secondaryButtonText }}
  77. </view>
  78. <view
  79. wx:if="{{ primaryButtonText }}"
  80. class="ant-modal-body-footer-horizontal-primary"
  81. style="{{ primaryButtonStyle || '' }}"
  82. bind:tap="onPrimaryButtonTap">
  83. {{ primaryButtonText }}
  84. </view>
  85. </view>
  86. <view
  87. wx:elif="{{ utils.getDirection(primaryButtonText, secondaryButtonText, cancelButtonText, type) === 'vertical' }}"
  88. class="ant-modal-body-footer-vertical">
  89. <view
  90. wx:if="{{ primaryButtonText }}"
  91. class="ant-modal-body-footer-vertical-primary"
  92. style="{{ primaryButtonStyle || '' }}"
  93. bind:tap="onPrimaryButtonTap">
  94. {{ primaryButtonText }}
  95. </view>
  96. <view
  97. wx:if="{{ secondaryButtonText }}"
  98. class="ant-modal-body-footer-vertical-secondary"
  99. style="{{ secondaryButtonStyle || '' }}"
  100. bind:tap="onSecondaryButtonTap">
  101. {{ secondaryButtonText }}
  102. </view>
  103. <view
  104. wx:if="{{ cancelButtonText }}"
  105. class="ant-modal-body-footer-vertical-cancel"
  106. style="{{ cancelButtonStyle || '' }}"
  107. bind:tap="onCancelButtonTap">
  108. {{ cancelButtonText }}
  109. </view>
  110. </view>
  111. </view>
  112. <ant-icon
  113. wx:if="{{ type === 'focus' && closable }}"
  114. type="CloseOutline"
  115. bind:tap="onClose"
  116. className="ant-modal-close" />
  117. </ant-popup>