water_xcx/miniprogram_npm/tdesign-miniprogram/image/image.wxml

46 lines
1.4 KiB
Plaintext
Raw Permalink Normal View History

2025-04-15 15:44:51 +08:00
<!-- 加载中占位 -->
<view
wx:if="{{isLoading}}"
class="{{prefix}}-class {{classPrefix}} {{classPrefix}}__mask {{classPrefix}}--loading {{classPrefix}}--shape-{{shape}}"
>
<t-loading
wx:if="{{loading === 'default'}}"
theme="dots"
size="40rpx"
loading
class="t-class-load"
t-class-text="{{classPrefix}}--loading-text"
></t-loading>
<view wx:elif="{{loading !== 'slot' && loading !== ''}}" class="{{classPrefix}}__common {{prefix}}-class-load">
{{loading}}
</view>
<slot wx:else name="loading" class="{{prefix}}-class-load" />
</view>
<!-- 加载失败占位 -->
<view
wx:elif="{{isFailed}}"
class="{{prefix}}-class {{classPrefix}} {{classPrefix}}__mask {{classPrefix}}--faild {{classPrefix}}--shape-{{shape}}"
>
<view wx:if="{{error === 'default'}}" style="font-size: 40rpx; color: #999" class="{{prefix}}-class-load">
<t-icon name="close" />
</view>
<view wx:elif="{{error !== 'slot' && error !== ''}}" class="{{classPrefix}}__common {{prefix}}-class-load">
{{error}}
</view>
<slot wx:else name="error" class="{{prefix}}-class-load"></slot>
</view>
<!-- 图片 -->
<image
id="image"
hidden="{{isLoading || isFailed}}"
class="{{prefix}}-class {{classPrefix}} {{classPrefix}}--shape-{{shape}}"
src="{{src}}"
style="{{widthStyle}}"
mode="{{mode}}"
webp="{{webp}}"
lazy-load="{{lazy}}"
bind:load="onLoaded"
bind:error="onLoadError"
show-menu-by-longpress="{{showMenuByLongpress}}"
/>