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