index.wxml 843 B

123456789101112131415161718192021222324252627282930313233
  1. <wxs src="../wxs/utils.wxs" module="utils" />
  2. <view
  3. style="{{ viewStyle }}"
  4. class="custom-class {{ utils.bem('image', { round })}}"
  5. bind:tap="onClick"
  6. >
  7. <image
  8. wx:if="{{ !error }}"
  9. src="{{ src }}"
  10. mode="{{ mode }}"
  11. lazy-load="{{ lazyLoad }}"
  12. class="image-class van-image__img"
  13. show-menu-by-longpress="{{ showMenuByLongpress }}"
  14. bind:load="onLoad"
  15. bind:error="onError"
  16. />
  17. <view
  18. wx:if="{{ loading && showLoading }}"
  19. class="loading-class van-image__loading"
  20. >
  21. <slot wx:if="{{ useLoadingSlot }}" name="loading" />
  22. <van-icon wx:else name="photo-o" size="22" />
  23. </view>
  24. <view
  25. wx:if="{{ error && showError }}"
  26. class="error-class van-image__error"
  27. >
  28. <slot wx:if="{{ useErrorSlot }}" name="error" />
  29. <van-icon wx:else name="warning-o" size="22" />
  30. </view>
  31. </view>