From 00f57159b4b315b189531526bd0184ba64e34c50 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 28 Apr 2025 00:17:43 +0800 Subject: [PATCH] =?UTF-8?q?sync=EF=BC=9A=E4=BF=AE=E5=A4=8D=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20https://gitee.com/sheepjs/shopro-uniapp/commit/00ac44d1df066?= =?UTF-8?q?a2af155f6a3bb24c106e2be1cec?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sheep/components/s-uploader/s-uploader.vue | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/sheep/components/s-uploader/s-uploader.vue b/sheep/components/s-uploader/s-uploader.vue index e0a37e34..fb72cf34 100644 --- a/sheep/components/s-uploader/s-uploader.vue +++ b/sheep/components/s-uploader/s-uploader.vue @@ -48,6 +48,8 @@ import uploadImage from './upload-image.vue'; import uploadFile from './upload-file.vue'; import sheep from '@/sheep'; + import { isEmpty } from 'lodash-es'; + let fileInput = null; /** * FilePicker 文件选择上传 @@ -516,11 +518,18 @@ * @param {Object} index */ delFile(index) { - this.$emit('delete', { - tempFile: this.files[index], - tempFilePath: this.files[index].url, - }); - this.files.splice(index, 1); + if (!isEmpty(this.files)) { + this.$emit('delete', { + tempFile: this.files[index], + tempFilePath: this.files[index].url, + }); + this.files.splice(index, 1); + } else { + this.$emit('delete', { + tempFilePath: this.url, + }); + } + this.$nextTick(() => { this.setEmit(); });