Code refactoring
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
:disabled="disabled"
|
||||
>
|
||||
<flat-picker slot-scope="{focus, blur}"
|
||||
:name="title"
|
||||
:name="dataName"
|
||||
@on-open="focus"
|
||||
@on-close="blur"
|
||||
:config="dateConfig"
|
||||
@@ -42,6 +42,11 @@ export default {
|
||||
default: '',
|
||||
description: "Modal header title"
|
||||
},
|
||||
dataName: {
|
||||
type: String,
|
||||
default: '',
|
||||
description: "Modal header title"
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: '',
|
||||
@@ -93,7 +98,7 @@ export default {
|
||||
|
||||
data() {
|
||||
return {
|
||||
real_model: this.model,
|
||||
real_model: '',
|
||||
}
|
||||
},
|
||||
|
||||
@@ -121,6 +126,13 @@ export default {
|
||||
|
||||
this.$emit('change', this.real_model);
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
real_model: function(val) {
|
||||
this.real_model = val;
|
||||
|
||||
this.$emit('interface', this.real_model);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@@ -231,6 +231,42 @@ export default {
|
||||
async mounted() {
|
||||
this.initDropzone();
|
||||
},
|
||||
|
||||
watch: {
|
||||
attachments: function (attachments) {
|
||||
attachments.forEach((attachment) => {
|
||||
var mockFile = {
|
||||
id: attachment[0].id,
|
||||
name: attachment[0].name,
|
||||
size: attachment[0].size,
|
||||
type: attachment[0].type,
|
||||
download: attachment[0].downloadPath,
|
||||
dropzone: 'edit',
|
||||
};
|
||||
|
||||
this.dropzone.emit("addedfile", mockFile);
|
||||
this.dropzone.options.thumbnail.call(this.dropzone, mockFile, attachment[0].path);
|
||||
|
||||
// Make sure that there is no progress bar, etc...
|
||||
this.dropzone.emit("complete", mockFile);
|
||||
}, this);
|
||||
|
||||
|
||||
|
||||
this.files.forEach(async (attachment) => {
|
||||
if (attachment.download) {
|
||||
attachment.previewElement.querySelector("[data-dz-download]").href = attachment.download;
|
||||
attachment.previewElement.querySelector("[data-dz-download]").classList.remove("d-none");
|
||||
}
|
||||
});
|
||||
|
||||
if (this.preview == 'single' && attachments.length == 1) {
|
||||
this.$nextTick(() => {
|
||||
document.querySelector("#dropzone-" + this._uid).classList.add("dz-max-files-reached");
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
|
Reference in New Issue
Block a user