12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <wxs src="../wxs/utils.wxs" module="utils" />
- <wxs src="./index.wxs" module="computed" />
- <view class="van-uploader">
- <view class="van-uploader__wrapper">
-
- <view
- wx:if="{{ previewImage }}"
- wx:for="{{ lists }}"
- wx:key="index"
- class="van-uploader__preview"
- data-index="{{ index }}"
- bindtap="onClickPreview"
- >
- <image
- wx:if="{{ item.isImage }}"
- mode="{{ imageFit }}"
- src="{{ item.thumb || item.url }}"
- alt="{{ item.name || ('图片' + index) }}"
- class="van-uploader__preview-image"
- style="{{ computed.sizeStyle({ previewSize }) }}"
- data-index="{{ index }}"
- bindtap="onPreviewImage"
- />
- <video
- wx:elif="{{ item.isVideo }}"
- src="{{ item.url }}"
- title="{{ item.name || ('视频' + index) }}"
- poster="{{ item.thumb }}"
- autoplay="{{ item.autoplay }}"
- object-fit="{{videoFit}}"
- referrer-policy="{{videoReferrerPolicy}}"
- class="van-uploader__preview-image"
- style="{{ computed.sizeStyle({ previewSize }) }}"
- data-index="{{ index }}"
- bindtap="onPreviewVideo"
- >
- </video>
- <view
- wx:else
- class="van-uploader__file"
- style="{{ computed.sizeStyle({ previewSize }) }}"
- data-index="{{ index }}"
- bindtap="onPreviewFile"
- >
- <van-icon name="description" class="van-uploader__file-icon" />
- <view class="van-uploader__file-name van-ellipsis">{{ item.name || item.url }}</view>
- </view>
- <view
- wx:if="{{ item.status === 'uploading' || item.status === 'failed' }}"
- class="van-uploader__mask"
- >
- <van-icon wx:if="{{ item.status === 'failed' }}" name="close" class="van-uploader__mask-icon" />
- <van-loading wx:else custom-class="van-uploader__loading" />
- <text wx:if="{{ item.message }}" class="van-uploader__mask-message">{{ item.message }}</text>
- </view>
- <view
- wx:if="{{ deletable && item.deletable }}"
- data-index="{{ index }}"
- class="van-uploader__preview-delete"
- catch:tap="deleteItem"
- >
- <van-icon name="cross" class="van-uploader__preview-delete-icon" />
- </view>
- </view>
-
- <block wx:if="{{ isInCount }}">
- <view class="van-uploader__slot" bindtap="startUpload">
- <slot />
- </view>
-
- <view
- wx:if="{{ showUpload }}"
- class="van-uploader__upload {{ disabled ? 'van-uploader__upload--disabled': ''}}"
- style="{{ computed.sizeStyle({ previewSize }) }}"
- bindtap="startUpload"
- >
- <van-icon name="{{ uploadIcon }}" class="van-uploader__upload-icon" />
- <text wx:if="{{ uploadText }}" class="van-uploader__upload-text">{{ uploadText }}</text>
- </view>
- </block>
- </view>
- </view>
|