修改图片上传替换地址问题

This commit is contained in:
熊丽君
2021-12-16 10:26:01 +08:00
parent 5ec6581af8
commit 5397d68280

View File

@ -90,11 +90,12 @@ export default {
// 然后将数组转为对象数组
this.fileList = list.map(item => {
if (typeof item === "string") {
if (item.indexOf(this.baseUrl) === -1) {
item = { name: this.baseUrl + item, url: this.baseUrl + item };
} else {
item = { name: item, url: item };
}
item = { name: item, url: item };
// if (item.indexOf(this.baseUrl) === -1) {
// item = { name: this.baseUrl + item, url: this.baseUrl + item };
// } else {
// item = { name: item, url: item };
// }
}
return item;
});
@ -187,7 +188,7 @@ export default {
let strs = "";
separator = separator || ",";
for (let i in list) {
strs += list[i].url.replace(this.baseUrl, "") + separator;
strs += list[i].url.replace(this.baseUrl, this.baseUrl) + separator;
}
return strs != '' ? strs.substr(0, strs.length - 1) : '';
}