【fix】图片上传组件的回显bug修改

This commit is contained in:
zer0Black
2022-09-14 20:26:59 +08:00
parent c74447a938
commit 5f5d7d18e4
2 changed files with 17 additions and 7 deletions
+14 -6
View File
@@ -114,20 +114,28 @@
},
methods:{
initFileList(paths){
if(!paths || paths.length === 0){
if(!paths || paths.length==0){
this.fileList = [];
return;
}
this.picUrl = true;
let fileList = [];
let arr = paths.split(",")
for(var a=0;a<arr.length;a++){
this.fileList.forEach((item)=>{
if (item.url === arr[a]){
item.uid = uidGenerator()
item.response.status = 'history'
let url = getFileAccessHttpUrl(arr[a]);
fileList.push({
uid: uidGenerator(),
name: arr[a],
status: 'done',
url: url,
response:{
status:"history",
message:arr[a]
}
})
}
this.fileList = fileList
},
beforeUpload: function(file){
var fileType = file.type;
@@ -149,7 +157,7 @@
this.picUrl = true;
fileList = fileList.map((file) => {
if (file.response) {
file.url = `${file.response.result.id}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.response.result.fileName}`;
file.url = `${file.response.result.id}`;
}
return file;
});