qtsk-vue3 0.0.24 → 0.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,8 +5,8 @@
|
|
5
5
|
drag
|
6
6
|
accept=".xls,.xlsx,.csv"
|
7
7
|
:name="name"
|
8
|
-
:limit="
|
9
|
-
:file-list="
|
8
|
+
:limit="limit"
|
9
|
+
:file-list="fileListRef"
|
10
10
|
:before-upload="beforeUpload"
|
11
11
|
:on-success="handleSuccess"
|
12
12
|
:headers="headers"
|
@@ -38,10 +38,11 @@ defineProps({
|
|
38
38
|
headers: {
|
39
39
|
type: Object,
|
40
40
|
default: () => ({})
|
41
|
-
}
|
41
|
+
},
|
42
|
+
limit: Number
|
42
43
|
})
|
43
44
|
|
44
|
-
const
|
45
|
+
const fileListRef = ref([])
|
45
46
|
const emits = defineEmits(['successUpload'])
|
46
47
|
const beforeUpload = (file) => {
|
47
48
|
const isAllowedType = /\.(xls|xlsx|csv)$/.test(file.name);
|
@@ -60,19 +61,14 @@ const handleSuccess = (res, file, fileList) => {
|
|
60
61
|
if (res.code === 200) {
|
61
62
|
const size = (file.size / 1024).toFixed(2)
|
62
63
|
const name = `${file.name} (${size}K)`
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
name
|
72
|
-
}
|
73
|
-
);
|
74
|
-
fileList.value = files
|
75
|
-
}
|
64
|
+
console.log('fileList.value1', fileListRef.value)
|
65
|
+
const files = fileListRef.value || []
|
66
|
+
files.push(
|
67
|
+
{
|
68
|
+
name
|
69
|
+
}
|
70
|
+
);
|
71
|
+
fileListRef.value = files
|
76
72
|
emits('successUpload', res)
|
77
73
|
} else {
|
78
74
|
Message.error(res.msg || res.data.msg || res.message || '上传失败')
|