From f2ca7c5f9fbc4201b5a5bb490e43b1615b6a0dda Mon Sep 17 00:00:00 2001 From: qirong <2032486488@qq.com> Date: 星期三, 28 二月 2024 10:04:03 +0800 Subject: [PATCH] 修改 --- src/components/FileUpload/index.vue | 26 +++++++++++++++++++++----- 1 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/components/FileUpload/index.vue b/src/components/FileUpload/index.vue index edc462e..1a0cf44 100644 --- a/src/components/FileUpload/index.vue +++ b/src/components/FileUpload/index.vue @@ -16,6 +16,7 @@ > <!-- 涓婁紶鎸夐挳 --> <el-button type="primary">閫夊彇鏂囦欢</el-button> +<!-- <el-progress :percentage="downloadProgress" />--> </el-upload> <!-- 涓婁紶鎻愮ず --> <div class="el-upload__tip" v-if="showTip"> @@ -45,7 +46,7 @@ }); const { proxy } = getCurrentInstance() as ComponentInternalInstance; -const emit = defineEmits(['update:modelValue','closePopup']); +const emit = defineEmits(['update:modelValue','closePopup','openPopup']); const number = ref(0); const uploadList = ref<any[]>([]); //浜掕仈缃戠 @@ -62,7 +63,7 @@ ); const fileUploadRef = ref<ElUploadInstance>(); - +const downloadProgress = ref(0); // watch(() => props.modelValue, async val => { // console.log(val,props.modelValue); // if (val) { @@ -158,16 +159,31 @@ const handleUploadError = () => { proxy?.$modal.msgError("涓婁紶鏂囦欢澶辫触"); } +const debounce = (fn: Function, delay = 1500) => { + let timer: number | null = null; + return (...args: any[]) => { + if (timer) { + clearTimeout(timer); + } + timer = setTimeout(() => { + fn(...args); + }, delay); + } +} const handleUploadProgress=(e: any) => { - emit('closePopup','123123'); + console.log('handleUploadProgress锛�'); + // downloadProgress.value = downloadProgress.value + 50 + // emit('closePopup','123123'); + // emit('openPopup','123123'); } // 涓婁紶鎴愬姛鍥炶皟 const handleUploadSuccess = (res: any, file: UploadFile) => { console.log(res,'resresres'); if (res.code === 200) { proxy?.$modal.msgSuccess("涓婁紶鏂囦欢鎴愬姛"); - emit('closePopup',res) - + setTimeout(()=>{ + emit('closePopup',res) + },1000) console.log('璋冪敤鐖剁粍浠�',res); fileUploadRef.value!.clearFiles() downloadLoadingInstance.close(); -- Gitblit v1.8.0