Skip to content

Commit 650a8ad

Browse files
committed
fix issue #8 forEach file list
1 parent c09f57b commit 650a8ad

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

dist/vue-upload-drop-images.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,21 @@ export default {
2323
dragLeave() {},
2424
drop(e) {
2525
let status = true;
26-
if (e && e.dataTransfer.files) {
27-
e.dataTransfer.files.forEach((file) => {
26+
let files = Array.from(e.dataTransfer.files)
27+
if (e && files) {
28+
files.forEach((file) => {
2829
if (file.type.startsWith("image") === false) status = false;
2930
});
3031
if (status == true) {
3132
if (
3233
this.$props.max &&
33-
e.dataTransfer.files.length + this.files.length > this.$props.max
34+
files.length + this.files.length > this.$props.max
3435
) {
3536
this.error = this.$props.maxError
3637
? this.$props.maxError
3738
: `Maximum files is` + this.$props.max;
3839
} else {
39-
this.files.push(...e.dataTransfer.files);
40+
this.files.push(...files);
4041
this.previewImgs();
4142
}
4243
} else {

0 commit comments

Comments
 (0)