message.wxml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <wxs src="./message.wxs" module="this"></wxs>
  2. <wxs src="../common/utils.wxs" module="_" />
  3. <import src="../common/template/icon.wxml" />
  4. <block wx:if="{{visible}}">
  5. <view
  6. class="{{classPrefix}} {{prefix}}-class {{classPrefix}}--{{theme}}"
  7. style="{{_._style([this.getMessageStyles(zIndex, offset, wrapTop), style, customStyle])}}"
  8. animation="{{showAnimation}}"
  9. id="{{classPrefix}}"
  10. aria-role="alert"
  11. >
  12. <view class="{{classPrefix}}__icon--left">
  13. <slot name="icon" />
  14. <template wx:if="{{_icon}}" is="icon" data="{{tClass: prefix + '-class-icon', ariaHidden: true, ..._icon }}" />
  15. </view>
  16. <view
  17. class="{{classPrefix}}__text-wrap {{marquee ? '{{classPrefix}}__text-nowrap' : ''}}"
  18. style="text-align: {{align}}"
  19. id="{{classPrefix}}__text-wrap"
  20. >
  21. <view class="{{classPrefix}}__text {{prefix}}-class-content" id="{{classPrefix}}__text" animation="{{animation}}">
  22. <block wx:if="{{content}}">{{content}}</block>
  23. <slot name="content" />
  24. </view>
  25. </view>
  26. <t-button
  27. wx:if="{{action}}"
  28. t-class="{{classPrefix}}__btn--right {{prefix}}-class-action"
  29. theme="primary"
  30. variant="text"
  31. size="small"
  32. bind:tap="handleBtnClick"
  33. >{{action}}</t-button
  34. >
  35. <slot name="action" />
  36. <view class="{{classPrefix}}__icon--right" bind:tap="handleClose">
  37. <slot name="close-btn" />
  38. <template
  39. wx:if="{{_closeBtn}}"
  40. is="icon"
  41. data="{{tClass: prefix + '-class-close-btn', ariaRole: 'button', ariaLabel: '关闭', ..._closeBtn }}"
  42. />
  43. </view>
  44. </view>
  45. </block>