From f107be0ee57c0460a651c4998afd0449685a5770 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com> Date: Sat, 7 May 2022 22:01:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=89=8B=E5=8A=A8=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/FileUpload/index.vue | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/FileUpload/index.vue b/src/components/FileUpload/index.vue index 74da4f1..f5a69b1 100644 --- a/src/components/FileUpload/index.vue +++ b/src/components/FileUpload/index.vue @@ -13,6 +13,7 @@ :data="data" :drag="drag" :headers="headers" + :auto-upload="autoUpload" class="upload-file-uploader" ref="upload" > @@ -100,7 +101,7 @@ const emit = defineEmits() const number = ref(0) const uploadList = ref([]) const baseUrl = import.meta.env.VITE_APP_BASE_API -const uploadFileUrl = ref(baseUrl + import.meta.env.VITE_APP_UPLOAD_URL ?? '/Common/UploadFile') // 上传的图片服务器地址 +const uploadFileUrl = ref(baseUrl + import.meta.env.VITE_APP_UPLOAD_URL) // 上传的图片服务器地址 const headers = ref({ Authorization: 'Bearer ' + getToken() }) const fileList = ref([]) const showTip = computed(() => props.isShowTip && (props.fileType || props.fileSize)) @@ -187,6 +188,7 @@ function handleUploadSuccess(response, uploadFile) { uploadList.value = [] number.value = 0 emit('update:modelValue', listToString(fileList.value)) + emit('success', listToString(fileList.value)) proxy.$modal.closeLoading() } } @@ -215,10 +217,13 @@ function listToString(list, separator) { } return strs != '' ? strs.substr(0, strs.length - 1) : '' } -// 提交上传 +// 手动提交上传 function submitUpload() { - this.$refs.upload.submit() + proxy.$refs.upload.submit() } +defineExpose({ + submitUpload, +})