提交 | 用户 | age
|
d98d05
|
1 |
<wxs src="../wxs/utils.wxs" module="utils" /> |
53cc6f
|
2 |
<wxs src="./index.wxs" module="computed" /> |
d98d05
|
3 |
|
S |
4 |
<view class="van-uploader"> |
|
5 |
<view class="van-uploader__wrapper"> |
|
6 |
<!-- 预览样式 --> |
|
7 |
<view |
|
8 |
wx:if="{{ previewImage }}" |
|
9 |
wx:for="{{ lists }}" |
|
10 |
wx:key="index" |
|
11 |
class="van-uploader__preview" |
|
12 |
data-index="{{ index }}" |
|
13 |
bindtap="onClickPreview" |
|
14 |
> |
|
15 |
<image |
|
16 |
wx:if="{{ item.isImage }}" |
|
17 |
mode="{{ imageFit }}" |
53cc6f
|
18 |
src="{{ item.thumb || item.url }}" |
d98d05
|
19 |
alt="{{ item.name || ('图片' + index) }}" |
S |
20 |
class="van-uploader__preview-image" |
53cc6f
|
21 |
style="{{ computed.sizeStyle({ previewSize }) }}" |
d98d05
|
22 |
data-index="{{ index }}" |
53cc6f
|
23 |
bindtap="onPreviewImage" |
d98d05
|
24 |
/> |
53cc6f
|
25 |
<video |
S |
26 |
wx:elif="{{ item.isVideo }}" |
|
27 |
src="{{ item.url }}" |
|
28 |
title="{{ item.name || ('视频' + index) }}" |
|
29 |
poster="{{ item.thumb }}" |
|
30 |
autoplay="{{ item.autoplay }}" |
|
31 |
class="van-uploader__preview-image" |
|
32 |
style="{{ computed.sizeStyle({ previewSize }) }}" |
|
33 |
data-index="{{ index }}" |
|
34 |
bindtap="onPreviewVideo" |
|
35 |
> |
|
36 |
</video> |
d98d05
|
37 |
<view |
S |
38 |
wx:else |
|
39 |
class="van-uploader__file" |
53cc6f
|
40 |
style="{{ computed.sizeStyle({ previewSize }) }}" |
S |
41 |
data-index="{{ index }}" |
|
42 |
bindtap="onPreviewFile" |
d98d05
|
43 |
> |
S |
44 |
<van-icon name="description" class="van-uploader__file-icon" /> |
53cc6f
|
45 |
<view class="van-uploader__file-name van-ellipsis">{{ item.name || item.url }}</view> |
d98d05
|
46 |
</view> |
S |
47 |
<view |
|
48 |
wx:if="{{ item.status === 'uploading' || item.status === 'failed' }}" |
|
49 |
class="van-uploader__mask" |
|
50 |
> |
53cc6f
|
51 |
<van-icon wx:if="{{ item.status === 'failed' }}" name="close" class="van-uploader__mask-icon" /> |
S |
52 |
<van-loading wx:else custom-class="van-uploader__loading" /> |
|
53 |
<text wx:if="{{ item.message }}" class="van-uploader__mask-message">{{ item.message }}</text> |
d98d05
|
54 |
</view> |
53cc6f
|
55 |
<view |
S |
56 |
wx:if="{{ deletable && item.deletable }}" |
d98d05
|
57 |
data-index="{{ index }}" |
53cc6f
|
58 |
class="van-uploader__preview-delete" |
S |
59 |
catch:tap="deleteItem" |
|
60 |
> |
|
61 |
<van-icon name="cross" class="van-uploader__preview-delete-icon" /> |
|
62 |
</view> |
d98d05
|
63 |
</view> |
S |
64 |
|
|
65 |
<!-- 上传样式 --> |
|
66 |
<block wx:if="{{ isInCount }}"> |
53cc6f
|
67 |
<view class="van-uploader__slot" bindtap="startUpload"> |
d98d05
|
68 |
<slot /> |
S |
69 |
</view> |
|
70 |
|
|
71 |
<!-- 默认上传样式 --> |
|
72 |
<view |
|
73 |
wx:if="{{ showUpload }}" |
|
74 |
class="van-uploader__upload {{ disabled ? 'van-uploader__upload--disabled': ''}}" |
53cc6f
|
75 |
style="{{ computed.sizeStyle({ previewSize }) }}" |
S |
76 |
bindtap="startUpload" |
d98d05
|
77 |
> |
S |
78 |
<van-icon name="{{ uploadIcon }}" class="van-uploader__upload-icon" /> |
|
79 |
<text wx:if="{{ uploadText }}" class="van-uploader__upload-text">{{ uploadText }}</text> |
|
80 |
</view> |
|
81 |
</block> |
|
82 |
</view> |
|
83 |
</view> |