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
| <template>
| <view>
| <up-upload :fileList="fileList" @afterRead="afterRead" @delete="deletePic" name="6" :maxCount="1" width="150"
| height="50">
| <image :src="src" mode="widthFix" style="width: 150px;height: 50px;"></image>
| </up-upload>
| </view>
| </template>
|
| <script setup>
| import {
| ref,
| reactive,
| defineProps
| } from 'vue';
| const props = defineProps({
| src: {
| type: String,
| default: ''
| }
| });
| // let isShow = false
| const fileList = reactive([{
| url: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
| }, ]);
| const deletePic = (event) => {
| fileList.splice(event.index, 1);
| };
| const afterRead = () => {
|
| };
| // 新增图片
| // const afterRead = async (event) => {
| // // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
| // let lists = [].concat(event.file);
| // let fileListLen = fileList1.value.length;
| // lists.map((item) => {
| // fileList1.value.push({
| // ...item,
| // status: 'uploading',
| // message: '上传中',
| // });
| // });
| // for (let i = 0; i < lists.length; i++) {
| // const result = await uploadFilePromise(lists[i].url);
| // let item = fileList1.value[fileListLen];
| // fileList1.value.splice(fileListLen, 1, {
| // ...item,
| // status: 'success',
| // message: '',
| // url: result,
| // });
| // fileListLen++;
| // }
| // };
| </script>
|
| <style>
|
| </style>
|
|