Upload: add url prop to upload file when list-type changed (#13771)

Upload: add url prop to upload file when list-type changed (#13771)
This commit is contained in:
Harlan 2018-12-29 13:25:31 +08:00 committed by GitHub
commit 2e9eb0f739
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -122,6 +122,20 @@ export default {
},
watch: {
listType(type) {
if (type === 'picture-card' || type === 'picture') {
this.uploadFiles.forEach(file => {
if (!file.url && file.raw) {
try {
file.url = URL.createObjectURL(file.raw);
} catch (err) {
console.error('[Element Error][Upload]', err);
return;
}
}
});
}
},
fileList: {
immediate: true,
handler(fileList) {