mirror of https://github.com/ElemeFE/element
Upload: create blob URL when picture displays (#12402)
* Upload: create blob URL when picture displays * Update index.vuepull/12684/head
parent
b8cdecebf7
commit
b7be905b1d
|
@ -146,11 +146,13 @@ export default {
|
|||
raw: rawFile
|
||||
};
|
||||
|
||||
try {
|
||||
file.url = URL.createObjectURL(rawFile);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return;
|
||||
if (this.listType === 'picture-card' || this.listType === 'picture') {
|
||||
try {
|
||||
file.url = URL.createObjectURL(rawFile);
|
||||
} catch (err) {
|
||||
console.error('[Element Error][Upload]', err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.uploadFiles.push(file);
|
||||
|
@ -241,6 +243,14 @@ export default {
|
|||
}
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
this.uploadFiles.forEach(file => {
|
||||
if (file.url && file.url.indexOf('blob:') === 0) {
|
||||
URL.revokeObjectURL(file.url);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
render(h) {
|
||||
let uploadList;
|
||||
|
||||
|
|
Loading…
Reference in New Issue