Commit b7be905b authored by hetech's avatar hetech Committed by GitHub

Upload: create blob URL when picture displays (#12402)

* Upload: create blob URL when picture displays

* Update index.vue
parent b8cdeceb
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment