toast.wxml 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <import src="../common/template/icon.wxml" />
  2. <wxs src="../common/utils.wxs" module="_" />
  3. <view
  4. wx:if="{{realVisible}}"
  5. class="{{_.cls(classPrefix, [direction, theme, ['with-text', message]])}} {{prefix}}-class {{transitionClass}}"
  6. style="{{_._style([ 'top:' + (placement === 'top' ? '25%' : placement === 'bottom' ? '75%': '45%'), style, customStyle])}}"
  7. bind:transitionend="onTransitionEnd"
  8. catch:touchstart="loop"
  9. >
  10. <view class="{{classPrefix}}__content {{classPrefix}}__content--{{direction}}">
  11. <t-loading
  12. wx:if="{{isLoading}}"
  13. theme="circular"
  14. size="{{direction === 'row' ? '48rpx' : '64rpx'}}"
  15. loading
  16. inherit-color
  17. layout="vertical"
  18. />
  19. <template
  20. wx:elif="{{_icon}}"
  21. is="icon"
  22. data="{{ ariaHidden: true, tClass: classPrefix + '__icon ' + classPrefix + '__icon--' + direction, ..._icon }}"
  23. />
  24. <slot name="icon" />
  25. <view aria-role="alert" class="{{classPrefix}}__text {{classPrefix}}__text--{{direction}}">{{message}}</view>
  26. <slot name="message" />
  27. </view>
  28. </view>
  29. <t-overlay
  30. style="{{ overlayProps.style || ''}}"
  31. visible="{{realVisible && (showOverlay || preventScrollThrough)}}"
  32. z-index="{{overlayProps.zIndex || 11000}}"
  33. backgroundColor="{{preventScrollThrough ? 'transparent' : overlayProps.backgroundColor || ''}}"
  34. preventScrollThrough="{{preventScrollThrough || overlayProps.preventScrollThrough}}"
  35. />