Commit 315d9b06 authored by 刘帅's avatar 刘帅

1.优化

parent 5ef59df4
......@@ -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 [];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment