fix图片上传问题

This commit is contained in:
不做码农 2022-05-16 18:09:34 +08:00
parent 3a113693a8
commit d072b40764

View File

@ -16,8 +16,7 @@
:headers="headers"
:file-list="fileList"
:on-preview="handlePictureCardPreview"
:class="{ hide: fileList.length >= limit }"
>
:class="{ hide: fileList.length >= limit }">
<el-icon class="avatar-uploader-icon"><plus /></el-icon>
</el-upload>
<!-- 上传提示 -->
@ -113,14 +112,20 @@ function handleRemove(file, files) {
//
function handleUploadSuccess(res) {
if (res.code != 200) {
proxy.$modal.msgError(`上传失败,原因:${res.msg}!`)
proxy.$modal.closeLoading()
fileList.value = []
return
}
uploadList.value.push({ name: res.data.fileName, url: res.data.url })
if (uploadList.value.length === number.value) {
fileList.value = fileList.value.filter((f) => f.url !== undefined).concat(uploadList.value)
uploadList.value = []
number.value = 0
emit('update:modelValue', listToString(fileList.value))
proxy.$modal.closeLoading()
}
proxy.$modal.closeLoading()
}
// loading