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

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

    <view
            class="loading-class van-image__loading"
            wx:if="{{ loading && showLoading }}"
    >
        <slot name="loading" wx:if="{{ useLoadingSlot }}"/>
        <van-icon custom-class="van-image__loading-icon" name="photo" wx:else/>
    </view>
    <view
            class="error-class van-image__error"
            wx:if="{{ error && showError }}"
    >
        <slot name="error" wx:if="{{ useErrorSlot }}"/>
        <van-icon custom-class="van-image__error-icon" name="photo-fail" wx:else/>
    </view>
</view>
