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="1"
9
- :file-list="fileList"
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 fileList = ref([])
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
- if (fileList.value?.length === 1) {
64
- fileList.value = [{
65
- name
66
- }];
67
- } else {
68
- const files = fileList.value || []
69
- files.push(
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 || '上传失败')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qtsk-vue3",
3
- "version": "0.0.24",
3
+ "version": "0.0.25",
4
4
  "description": "vue3版组件库",
5
5
  "main": "./package/index.js",
6
6
  "scripts": {