index.wxml
1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<wxs src="../wxs/utils.wxs" module="utils" />
<view
class="van-uploader"
>
<view class="van-uploader__wrapper">
<!-- 预览样式 -->
<block wx:if="{{ previewImage }}">
<view
wx:for="{{ lists }}"
wx:key="{{ index }}"
class="van-uploader__preview"
>
<image
wx:if="{{ item.isImage }}"
mode="{{ imageFit }}"
src="{{ item.url || item.path }}"
alt="{{ item.name || ('图片' + index) }}"
class="van-uploader__preview-image"
style="width: {{ computedPreviewSize }}px; height: {{ computedPreviewSize }}px;"
data-url="{{ item.url || item.path }}"
bind:tap="doPreviewImage"
/>
<view
wx:else
class="van-uploader__file"
style="width: {{ computedPreviewSize }}px; height: {{ computedPreviewSize }}px;"
>
<van-icon name="description" class="van-uploader__file-icon" />
<view class="van-uploader__file-name van-ellipsis">{{ item.name || item.url || item.path }}</view>
</view>
<van-icon
name="delete"
class="van-uploader__preview-delete"
bind:tap="deleteItem"
data-index="{{ index }}"
/>
</view>
</block>
<!-- 上传样式 -->
<block wx:if="{{ isInCount }}">
<block wx:if="{{ useSlot }}">
<view class="van-uploader__slot" bind:tap="startUpload">
<slot />
</view>
</block>
<block wx:else>
<!-- 默认上传样式 -->
<view
class="van-uploader__upload"
style="width: {{ computedPreviewSize }}px; height: {{ computedPreviewSize }}px;"
bind:tap="startUpload"
>
<van-icon name="plus" class="van-uploader__upload-icon" />
<text wx:if="{{ uploadText }}" class="van-uploader__upload-text">{{ uploadText }}</text>
</view>
</block>
</block>
</view>
</view>