mirror of https://github.com/ElemeFE/element
Upload: optimize code (#13973)
parent
6231a39361
commit
5ae443a408
|
@ -124,15 +124,15 @@ export default {
|
|||
watch: {
|
||||
listType(type) {
|
||||
if (type === 'picture-card' || type === 'picture') {
|
||||
this.uploadFiles.forEach(file => {
|
||||
this.uploadFiles = this.uploadFiles.map(file => {
|
||||
if (!file.url && file.raw) {
|
||||
try {
|
||||
file.url = URL.createObjectURL(file.raw);
|
||||
} catch (err) {
|
||||
console.error('[Element Error][Upload]', err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
return file;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue