From e98664be8db1a317d401143540269a2356200e1d Mon Sep 17 00:00:00 2001 From: AsherSun Date: Tue, 16 Nov 2021 13:50:14 +0800 Subject: [PATCH] =?UTF-8?q?fix(uploader):=20=E4=BF=AE=E5=A4=8D=E5=B0=8F?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E7=AB=AF=E4=BC=A0=E5=9B=BE=E5=90=8E=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E9=97=AE=E9=A2=98=20(#836)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(uploader): Upload quantity limit * fix(uploader): 修复小程序端传图后报错问题 Co-authored-by: 无始 --- src/packages/__VUE/uploader/index.taro.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/packages/__VUE/uploader/index.taro.vue b/src/packages/__VUE/uploader/index.taro.vue index 40feca1b4..c812171ad 100644 --- a/src/packages/__VUE/uploader/index.taro.vue +++ b/src/packages/__VUE/uploader/index.taro.vue @@ -23,7 +23,7 @@ @@ -233,12 +233,17 @@ export default create({ }; const readFile = (files: Taro.chooseImage.ImageFile[]) => { + const imgReg = /\.(png|jpeg|jpg|webp|gif)$/gi; files.forEach((file: Taro.chooseImage.ImageFile, index: number) => { + let fileType = file.type; const fileItem = reactive(new FileItem()); + if (!fileType && imgReg.test(file.path)) { + fileType = 'image'; + } fileItem.path = file.path; fileItem.name = file.path; fileItem.status = 'ready'; - fileItem.type = file.type; + fileItem.type = fileType; if (props.isPreview) { fileItem.url = file.path; } -- GitLab