diff --git a/propertyManagement-ui/src/components/ImageUpload/index.vue b/propertyManagement-ui/src/components/ImageUpload/index.vue index 4f5fd12554eb4cefa4625b0a799b3e5644c07bf0..38b169fd0520c617f6a7bb1b83a3e20710b5dc7b 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 [];