Skip to content

Commit 1eb2917

Browse files
committed
Merge branch 'rifaideen-vue2' into vue2
2 parents c3c76ac + 9b2b713 commit 1eb2917

File tree

5 files changed

+29
-8
lines changed

5 files changed

+29
-8
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ Many of these props are inherited from [dropzone configuration so see their doco
7878
| resizeMimeType | String | The mime type of the resized image (before it gets uploaded to the server). If `null` the original mime type will be used. To force `jpeg`, for example, use `image/jpeg`. `Default : null` |
7979
| resizeQuality | Number | The quality of the resized images. `Default : null` |
8080
| resizeMethod | String | How the images should be scaled down in case both, `resizeWidth` and `resizeHeight` are provided. Can be either `contain` or `crop`. `Default : 'contain'` |
81+
| duplicateCheck | Boolean | Whether to check for duplicate file by file name. if true `duplicate-file` event will be emitted. `Default : 'false'` |
8182

8283
## Custom Dropzone preview template
8384

@@ -133,6 +134,7 @@ Events emitted by the component to the parent.
133134
| vdropzone-queue-complete(file, xhr, formData) | Fired when queue has been completely processed/ uploaded.|
134135
| vdropzone-total-upload-progress(totaluploadprogress, totalBytes, totalBytesSent) | This event can be used to show the overall upload progress of all files. Note : `totaluploadprogress (0-100)`|
135136
| vdropzone-mounted() | Fired when dropzone component is mounted. |
137+
| duplicate-file(file) | Fired when duplicateCheck is enabled. |
136138

137139

138140
## Development

dev/bundle.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/bundle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vue2-dropzone.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.vue

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@
115115
uploadMultiple:{
116116
type: Boolean,
117117
default: false
118+
},
119+
duplicateCheck:{
120+
type: Boolean,
121+
default: false
118122
}
119123
},
120124
methods: {
@@ -271,6 +275,21 @@
271275
});
272276
273277
this.dropzone.on('addedfile', function (file) {
278+
/**
279+
* If Duplicate Check enabled remove duplicate file and emit the event.
280+
*/
281+
if (vm.duplicateCheck) {
282+
if (this.files.length) {
283+
var _i, _len;
284+
for (_i = 0, _len = this.files.length; _i < _len - 1; _i++) {
285+
if (this.files[_i].name === file.name) {
286+
this.removeFile(file);
287+
vm.$emit('duplicate-file', file)
288+
}
289+
}
290+
}
291+
}
292+
274293
vm.$emit('vdropzone-file-added', file)
275294
});
276295

0 commit comments

Comments
 (0)