mirror of
https://gitee.com/ElemeFE/element.git
synced 2024-12-02 12:18:46 +08:00
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:
commit
2e9eb0f739
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user