Skip to content

Commit 57a74db

Browse files
authored
Merge branch 'vue2' into vue2
2 parents 0a21318 + ecc7cdb commit 57a74db

File tree

5 files changed

+38
-11
lines changed

5 files changed

+38
-11
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ Many of these props are inherited from [dropzone configuration so see their doco
8383
| method | String | The HTTP method used to submit form file data. `Default:post`|
8484
| capture | boolean | If `null`, no capture type will be specified If camera, mobile devices will skip the file selection and choose camera If microphone, mobile devices will skip the file selection and choose the microphone If camcorder, mobile devices will skip the file selection and choose the camera in video mode On apple devices multiple must be set to false. AcceptedFiles may need to be set to an appropriate mime type `(e.g. "image/", "audio/", or "video/*")`. `Default:null` |
8585
| hiddenInputContainer | String | Element the hidden input field will be appended to. This might be important in case you use frameworks to switch the content of your page. `Default:body`|
86+
| confirm | Function | A function for overriding native confirmation dialog box of browser. `Parameters: question, accepted, rejected`|
87+
88+
8689
## Custom Dropzone preview template
8790

8891
> NOTE : Props like `thumbnailWidth,thumbnailHeight, useFontAwesome` will not work when you override the dropzone preview. No worry you can refer [demo file](demo/custom-dropzone-preview.vue) to achieve same. :) Don't forgot to add your styles in `<style>`
@@ -128,6 +131,7 @@ Events emitted by the component to the parent.
128131
|------------|-------------|
129132
| vdropzone-file-added(file) | File added to the dropzone.|
130133
| vdropzone-files-added(file) | Files added to the dropzone.|
134+
| vdropzone-file-added-manually(file) | Manually added file to the dropzone |
131135
| vdropzone-success(file, response) | File successfully uploaded.|
132136
| vdropzone-error(file) | File uploaded encountered an error.|
133137
| vdropzone-removed-file(file, error, xhr) | A file was removed from the dropzone.|
@@ -140,6 +144,22 @@ Events emitted by the component to the parent.
140144
| duplicate-file(file) | Fired when duplicateCheck is enabled. |
141145

142146

147+
## Listening to other Dropzone events
148+
If you've referenced your tag with a ref property/tag as described in 'Using Methods', you can then access the Dropzone instance as well. This is useful if, for example, you want to add event listeners that have not been pre-configured (see below)
149+
From your parent Vue instance:
150+
```javascript
151+
mounted () {
152+
this.$refs.dropzone.dropzone.on('addedfile', function (file) {
153+
if (this.files.length > 1) {
154+
this.removeFile(this.files[0])
155+
}
156+
})
157+
this.$refs.dropzone.dropzone.on('maxfilesexceeded', function (file) {
158+
this.removeFile(file)
159+
})
160+
}
161+
```
162+
143163
## Development
144164

145165
``` bash

dev/bundle.js

Lines changed: 7 additions & 7 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: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
type: [Boolean, String],
2020
default: true
2121
},
22+
confirm: {
23+
type: Function,
24+
default: undefined
25+
},
2226
paramName: {
2327
type: String,
2428
default: 'file'
@@ -247,6 +251,9 @@
247251
}
248252
let Dropzone = require('dropzone');
249253
Dropzone.autoDiscover = false;
254+
if (this.confirm) {
255+
Dropzone.confirm = this.getProp(this.confirm, this.dropzoneOptions.confirm);
256+
}
250257
let element = document.getElementById(this.id);
251258
this.dropzone = new Dropzone(element, {
252259
clickable : this.getProp(this.clickable,this.dropzoneOptions.clickable),
@@ -349,7 +356,7 @@
349356
vm.$emit('vdropzone-mounted');
350357
},
351358
beforeDestroy () {
352-
this.dropzone.disable();
359+
this.dropzone.destroy();
353360
}
354361
}
355362
</script>

0 commit comments

Comments
 (0)