image.wxml 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <!-- 加载中占位 -->
  2. <view
  3. wx:if="{{isLoading}}"
  4. class="{{prefix}}-class {{classPrefix}} {{classPrefix}}__mask {{classPrefix}}--loading {{classPrefix}}--shape-{{shape}}"
  5. >
  6. <t-loading
  7. wx:if="{{loading === 'default'}}"
  8. theme="dots"
  9. size="40rpx"
  10. loading
  11. class="t-class-load"
  12. t-class-text="{{classPrefix}}--loading-text"
  13. ></t-loading>
  14. <view wx:elif="{{loading !== 'slot' && loading !== ''}}" class="{{classPrefix}}__common {{prefix}}-class-load">
  15. {{loading}}
  16. </view>
  17. <slot wx:else name="loading" class="{{prefix}}-class-load" />
  18. </view>
  19. <!-- 加载失败占位 -->
  20. <view
  21. wx:elif="{{isFailed}}"
  22. class="{{prefix}}-class {{classPrefix}} {{classPrefix}}__mask {{classPrefix}}--faild {{classPrefix}}--shape-{{shape}}"
  23. >
  24. <view wx:if="{{error === 'default'}}" style="font-size: 40rpx; color: #999" class="{{prefix}}-class-load">
  25. <t-icon name="close" />
  26. </view>
  27. <view wx:elif="{{error !== 'slot' && error !== ''}}" class="{{classPrefix}}__common {{prefix}}-class-load">
  28. {{error}}
  29. </view>
  30. <slot wx:else name="error" class="{{prefix}}-class-load"></slot>
  31. </view>
  32. <!-- 图片 -->
  33. <image
  34. id="image"
  35. hidden="{{isLoading || isFailed}}"
  36. class="{{prefix}}-class {{classPrefix}} {{classPrefix}}--shape-{{shape}}"
  37. src="{{src}}"
  38. style="{{widthStyle}}"
  39. mode="{{mode}}"
  40. webp="{{webp}}"
  41. lazy-load="{{lazy}}"
  42. bind:load="onLoaded"
  43. bind:error="onLoadError"
  44. show-menu-by-longpress="{{showMenuByLongpress}}"
  45. />