[Vuejs]-Clear upload area in Vue2-Dropzone

4👍

Assume you have vue-dropzone with ref in template

 <vue-dropzone ref="myVueDropzone" id="dropzone">
 </vue-dropzone>

then you should use

  this.$refs.myVueDropzone.removeAllFiles()

👤ittus

0👍

The removeAllFiles() is kind of a hack. It won’t work for some cases.

For example, it will not ‘reset’ the Dropzones’ options object. So if you want to do validations for diferent cases via the options object, it will not reset with the removeAllFiles() method.

The right way to reset the Dropzone (or any Vue object in that matter) is to set and change the :key attribute. Like this for example:

<vue-dropzone :key="`dropzone-${dynamicVariableOrJustSomeCounter}`">
</vue-dropzone>
👤Igor

Leave a comment