image.wxml 1.3 KB

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