mirror of
https://github.com/ElemeFE/element.git
synced 2025-12-16 11:44:01 +08:00
Upload: optimize code (#13973)
This commit is contained in:
@@ -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;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user