fix:文件上传组件选择文件未响应问题

This commit is contained in:
不做码农 2022-12-15 14:57:38 +08:00
parent 9a2fed61d2
commit a2dd3ee236
2 changed files with 14 additions and 14 deletions

View File

@ -4,7 +4,7 @@
multiple
:action="uploadFileUrl"
:before-upload="handleBeforeUpload"
:file-list="fileList"
v-model:file-list="fileList"
:limit="limit"
:on-error="handleUploadError"
:on-exceed="handleExceed"
@ -15,8 +15,7 @@
:headers="headers"
:auto-upload="autoUpload"
class="upload-file-uploader"
ref="upload"
>
ref="upload">
<!-- 拖拽上传 -->
<template v-if="drag">
<el-icon class="el-icon--upload">
@ -63,37 +62,37 @@ const props = defineProps({
//
limit: {
type: Number,
default: 5,
default: 5
},
// (MB)
fileSize: {
type: Number,
default: 5,
default: 5
},
// , ['png', 'jpg', 'jpeg']
fileType: {
type: Array,
default: () => ['doc', 'xls', 'ppt', 'txt', 'pdf'],
default: () => ['doc', 'xls', 'ppt', 'txt', 'pdf']
},
//
isShowTip: {
type: Boolean,
default: true,
default: true
},
//
drag: {
type: Boolean,
default: false,
default: false
},
//
autoUpload: {
type: Boolean,
default: true,
default: true
},
//
data: {
type: Object,
},
type: Object
}
})
const { proxy } = getCurrentInstance()
@ -128,7 +127,7 @@ watch(
return []
}
},
{ deep: true, immediate: true },
{ deep: true, immediate: true }
)
//
@ -170,6 +169,7 @@ function handleExceed() {
//
function handleUploadError(err) {
proxy.$modal.msgError('上传失败')
proxy.$modal.closeLoading()
}
//
@ -222,7 +222,7 @@ function submitUpload() {
proxy.$refs.upload.submit()
}
defineExpose({
submitUpload,
submitUpload
})
</script>

View File

@ -14,7 +14,7 @@
:on-remove="handleRemove"
:show-file-list="true"
:headers="headers"
:file-list="fileList"
v-model:file-list="fileList"
:on-preview="handlePictureCardPreview"
:class="{ hide: fileList.length >= limit }">
<el-icon class="avatar-uploader-icon"><plus /></el-icon>