index.wxml 1014 B

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