From d5d6bd961fc85a952715c4bc518472b2938bb1b8 Mon Sep 17 00:00:00 2001 From: wyx <51903@qq.com> Date: Wed, 8 Mar 2023 20:30:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BD=9C=E4=B8=9A=E9=99=90=E5=88=B6?= =?UTF-8?q?=E8=A7=86=E9=A2=91=E6=96=87=E4=BB=B6=E6=A0=BC=E5=BC=8F=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/img/UploadImgHomeWork.vue | 29 +++++++++++++++--------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/components/img/UploadImgHomeWork.vue b/src/components/img/UploadImgHomeWork.vue index 4d0d827..c544b72 100644 --- a/src/components/img/UploadImgHomeWork.vue +++ b/src/components/img/UploadImgHomeWork.vue @@ -51,19 +51,26 @@ function handleChange(file) { f.uid = file.uid; file.raw = f; console.log(file.raw) - imageRef.value.submit(); + if(file.raw.name.includes('.mp4') || file.raw.name.includes('.jpeg')){ + files.value = [] + emit('update:value', files.value) + ElMessage.error(`暂不支持此格式文件上传`); + return + }else{ + imageRef.value.submit(); - if (file.response && file.response.code === 200) { - file.url = file.response.data - } - const index = files.value.findIndex(f => f.uid === file.uid) - if (index === -1) { - files.value.unshift(file) - } else { - files.value[index] = file - } + if (file.response && file.response.code === 200) { + file.url = file.response.data + } + const index = files.value.findIndex(f => f.uid === file.uid) + if (index === -1) { + files.value.unshift(file) + } else { + files.value[index] = file + } - emit('update:value', files.value) + emit('update:value', files.value) + } } function remove(i) {