diff --git a/src/components/UploadFile/src/UploadFile.vue b/src/components/UploadFile/src/UploadFile.vue index 1754086204f9bdbc69e95f5d47d9b90abc8d2d2a..8e09130425ad4eb822f8222475cc077101acec5d 100644 --- a/src/components/UploadFile/src/UploadFile.vue +++ b/src/components/UploadFile/src/UploadFile.vue @@ -19,6 +19,7 @@ :show-file-list="true" class="upload-file-uploader" name="file" + :accept="computedAccept" > @@ -196,6 +197,11 @@ const emitUpdateModelValue = () => { } emit('update:modelValue', result) } + +// 接收上传的文件类型,将 fileType中的['doc', 'pdf'] 转换为 '.doc,.pdf'格式 +const computedAccept = computed(() => { + return props.fileType.map(type => `.${type}`).join(',') +})