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

pull/13786/head
HarlanLuo 2018-12-17 10:30:13 +08:00
parent 16311d1e32
commit c3e8b77d47
1 changed files with 14 additions and 0 deletions

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) {