index.wxml 992 Bytes
Newer Older
李嘉林 committed
1
<wxs src="../wxs/utils.wxs" module="utils" />
程默 committed
2
<wxs src="./index.wxs" module="computed" />
李嘉林 committed
3 4

<view
程默 committed
5
  style="{{ computed.rootStyle({ width, height, radius }) }}"
李嘉林 committed
6 7 8 9 10 11
  class="custom-class {{ utils.bem('image', { round })}}"
  bind:tap="onClick"
>
  <image
    wx:if="{{ !error }}"
    src="{{ src }}"
程默 committed
12
    mode="{{ computed.mode(fit) }}"
李嘉林 committed
13 14 15 16 17 18 19 20 21 22 23 24
    lazy-load="{{ lazyLoad }}"
    class="image-class van-image__img"
    show-menu-by-longpress="{{ showMenuByLongpress }}"
    bind:load="onLoad"
    bind:error="onError"
  />

  <view
    wx:if="{{ loading && showLoading }}"
    class="loading-class van-image__loading"
  >
    <slot wx:if="{{ useLoadingSlot }}" name="loading" />
程默 committed
25
    <van-icon wx:else name="photo" custom-class="van-image__loading-icon" />
李嘉林 committed
26 27 28 29 30 31
  </view>
  <view
    wx:if="{{ error && showError }}"
    class="error-class van-image__error"
  >
    <slot wx:if="{{ useErrorSlot }}" name="error" />
程默 committed
32
    <van-icon wx:else name="photo-fail" custom-class="van-image__error-icon" />
李嘉林 committed
33 34
  </view>
</view>