mirror of
https://gitee.com/ElemeFE/element.git
synced 2024-12-03 12:48:45 +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: {
|
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: {
|
fileList: {
|
||||||
immediate: true,
|
immediate: true,
|
||||||
handler(fileList) {
|
handler(fileList) {
|
||||||
|
Loading…
Reference in New Issue
Block a user