dropzone fixed href issue..
This commit is contained in:
parent
4f6d2a0435
commit
6852d83cb9
@ -107,11 +107,11 @@ export default {
|
||||
let preview = this.preview == 'single' ? this.$refs.previewSingle : this.$refs.previewMultiple;
|
||||
|
||||
if (this.configurations.maxFiles === undefined && this.multiple == false) {
|
||||
this.configurations.maxFiles = 1
|
||||
this.configurations.maxFiles = 1;
|
||||
}
|
||||
|
||||
if (this.configurations.acceptedFiles === undefined) {
|
||||
this.configurations.acceptedFiles = 'image/*'
|
||||
this.configurations.acceptedFiles = 'image/*';
|
||||
}
|
||||
|
||||
let finalOptions = {
|
||||
@ -123,7 +123,7 @@ export default {
|
||||
autoProcessQueue: false,
|
||||
|
||||
init: function () {
|
||||
let dropzone = this
|
||||
let dropzone = this;
|
||||
|
||||
dropzone.on('addedfile', function (file) {
|
||||
self.files.push(file);
|
||||
@ -160,20 +160,25 @@ export default {
|
||||
}
|
||||
})
|
||||
|
||||
if (self.attachments.length) {
|
||||
setTimeout(() => {
|
||||
self.attachments.forEach(async (attachment) => {
|
||||
let blob = await self.getAttachmentContent(attachment.path)
|
||||
let file = new File([blob], attachment.name, { type: blob.type })
|
||||
let blob = await self.getAttachmentContent(attachment.path);
|
||||
let file = new File([blob], attachment.name, { type: blob.type });
|
||||
|
||||
dropzone.displayExistingFile(file, attachment.path, () => {
|
||||
file.previewElement.querySelector("[data-dz-download]").href = attachment.downloadPath
|
||||
file.previewElement.querySelector("[data-dz-download]").classList.remove("d-none")
|
||||
})
|
||||
})
|
||||
if (attachment.downloadPath) {
|
||||
file.previewElement.querySelector("[data-dz-download]").href = attachment.downloadPath;
|
||||
file.previewElement.querySelector("[data-dz-download]").classList.remove("d-none");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
if (self.preview == 'single' && self.attachments.length == 1)
|
||||
if (self.preview == 'single' && self.attachments.length == 1) {
|
||||
document.querySelector("#dropzone").classList.add("dz-max-files-reached");
|
||||
}, 750)
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -181,9 +186,10 @@ export default {
|
||||
|
||||
preview.innerHTML = '';
|
||||
},
|
||||
|
||||
async getAttachmentContent(imageUrl) {
|
||||
return await axios.get(imageUrl, { responseType: 'blob' }).then(function (response) {
|
||||
return response.data
|
||||
return response.data;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user