File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
web/src/components/selectFile Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div >
3
3
<el-upload
4
+ v-model:file-list =" fileList"
4
5
multiple
5
6
:action =" `${getBaseUrl()}/fileUploadAndDownload/upload?noSave=1`"
6
7
:on-error =" uploadError"
7
8
:on-success =" uploadSuccess"
8
9
:show-file-list =" true"
9
- :file-list =" fileList"
10
10
:limit =" limit"
11
11
:accept =" accept"
12
12
class =" upload-btn"
13
13
>
14
- <el-button type =" primary" >上传文件</el-button >
14
+ <el-button type =" primary" >
15
+ 上传文件
16
+ </el-button >
15
17
</el-upload >
16
18
</div >
17
19
</template >
@@ -48,7 +50,6 @@ const fileList = ref(props.modelValue)
48
50
const emits = defineEmits ([' update:modelValue' , ' on-success' , ' on-error' ])
49
51
50
52
watch (fileList .value , (val ) => {
51
- console .log (val)
52
53
emits (' update:modelValue' , val)
53
54
})
54
55
@@ -60,7 +61,15 @@ watch(
60
61
{ immediate: true }
61
62
)
62
63
const uploadSuccess = (res ) => {
63
- const { data } = res
64
+ const { data ,code } = res
65
+ if (code !== 0 ){
66
+ ElMessage ({
67
+ type: ' error' ,
68
+ message: ' 上传失败' + res .msg
69
+ })
70
+ fileList .value .pop ()
71
+ return
72
+ }
64
73
if (data .file ) {
65
74
fileList .value .push ({
66
75
name: data .file .name ,
You can’t perform that action at this time.
0 commit comments