1.修复文件第二次上传会失败的问题 2. 2.0版本上传文件可自动读取文件名

This commit is contained in:
p71924506 2022-12-21 15:40:31 +08:00
parent 7cd9e4f2a4
commit 0cb087c4b6
1 changed files with 4 additions and 1 deletions

View File

@ -59,6 +59,7 @@
<el-upload <el-upload
class="upload-demo" class="upload-demo"
drag drag
ref="fileUpload"
:headers="headers" :headers="headers"
action="/api/file/uploadFile" action="/api/file/uploadFile"
:on-success="uploadSuccess" :on-success="uploadSuccess"
@ -350,11 +351,12 @@ export default {
}, },
// //
uploadSuccess(response){ uploadSuccess(response, file, fileList){
if (response.status == 0) { if (response.status == 0) {
Message.success("上传成功") Message.success("上传成功")
//ID //ID
this.filesInfo.location = response.url this.filesInfo.location = response.url
this.filesInfo.name = file.name
} }
}, },
@ -371,6 +373,7 @@ export default {
Message.success("上传成功") Message.success("上传成功")
this.handleClose() this.handleClose()
this.selectByType() this.selectByType()
this.$refs.fileUpload.clearFiles()
} }
}) })
}else{ }else{