From 315d9b06095640b3620b6ebab95289d363df2ae9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=B8=85?= Date: Fri, 30 May 2025 11:19:29 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/ImageUpload/index.vue | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/propertyManagement-ui/src/components/ImageUpload/index.vue b/propertyManagement-ui/src/components/ImageUpload/index.vue index 4f5fd12..38b169f 100644 --- a/propertyManagement-ui/src/components/ImageUpload/index.vue +++ b/propertyManagement-ui/src/components/ImageUpload/index.vue @@ -89,21 +89,33 @@ export default { value: { async handler(val) { if (val) { - // 首先将值转为数组 - let list; - if (Array.isArray(val)) { - list = val; - } else { - await listByIds(val).then(res => { - list = res.data; - }) - } + const list = Array.isArray(val) ? val : this.value.split(','); // 然后将数组转为对象数组 this.fileList = list.map(item => { - // 此处name使用ossId 防止删除出现重名 - item = { name: item.ossId, url: item.url, ossId: item.ossId }; + if (typeof item === "string") { + if (item.indexOf(this.baseUrl) === -1) { + item = { name: item, url: item }; + } else { + item = { name: item, url: item }; + } + } return item; }); + // 首先将值转为数组 + // let list; + // if (Array.isArray(val)) { + // list = val; + // } else { + // await listByIds(val).then(res => { + // list = res.data; + // }) + // } + // // 然后将数组转为对象数组 + // this.fileList = list.map(item => { + // // 此处name使用ossId 防止删除出现重名 + // item = { name: item.ossId, url: item.url, ossId: item.ossId }; + // return item; + // }); } else { this.fileList = []; return []; -- 2.22.0