<wxs src="../wxs/utils.wxs" module="utils" />
<wxs src="./index.wxs" module="computed" />


<view
  style="{{ computed.rootStyle({ width, height, radius }) }}"
  class="aio-class {{ utils.bem('image', { round })}}"
  bind:tap="onClick"
>
  <image
    wx:if="{{ !error }}"
    src="{{ !src ? computed.prefix + name + '.' + suffix : src }}"
    mode="{{ computed.mode(fit) }}"
    lazy-load="{{ lazyLoad }}"
    webp="{{ webp }}"
    class="image-class aio-image__img"
    show-menu-by-longpress="{{ showMenuByLongpress }}"
    bind:load="onLoad"
    bind:error="onError"
  />

  <view
    wx:if="{{ loading && showLoading }}"
    class="loading-class aio-image__loading"
  >
    <slot wx:if="{{ useLoadingSlot }}" name="loading" />
  </view>
  <view
    wx:if="{{ error && showError }}"
    class="error-class aio-image__error"
  >
    <slot wx:if="{{ useErrorSlot }}" name="error" />
  </view>
</view>
