Skip to content

Commit c3c76ac

Browse files
authored
Merge pull request #134 from MekDrop/vue2
Options parameters for changing some ways how maxFiles and files.length after using manuallyAddFile method works. Fixes #123
2 parents cacd770 + 8d6ea3d commit c3c76ac

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/index.vue

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,18 @@
118118
}
119119
},
120120
methods: {
121-
manuallyAddFile: function (file, fileUrl, callback, crossOrigin) {
121+
manuallyAddFile: function (file, fileUrl, callback, crossOrigin, options) {
122122
this.dropzone.emit("addedfile", file);
123123
this.dropzone.emit("thumbnail", file, fileUrl);
124124
this.dropzone.createThumbnailFromUrl(file, fileUrl, callback, crossOrigin);
125-
this.dropzone.emit("complete", file);
125+
this.dropzone.emit("complete", file);
126+
if ((typeof options.dontSubstractMaxFiles == 'undefined') || !options.dontSubstractMaxFiles) {
127+
this.dropzone.options['maxFiles'] = this.dropzone.options['maxFiles'] - 1;
128+
}
129+
if ((typeof options.addToFiles != 'undefined') && options.addToFiles) {
130+
this.dropzone.files.push(file);
131+
}
126132
this.$emit('vdropzone-file-added-manually', file);
127-
this.dropzone.options['maxFiles'] = this.dropzone.options['maxFiles'] - 1;
128133
},
129134
setOption: function (option, value) {
130135
this.dropzone.options[option] = value
@@ -407,4 +412,4 @@
407412
}
408413
}
409414
}
410-
</style>
415+
</style>

0 commit comments

Comments
 (0)