rowanwins / vue-dropzone

A Vue.js component for Dropzone.js - a drag’n’drop file uploads utility with image previews
https://rowanwins.github.io/vue-dropzone/docs/dist
MIT License
2.02k stars 1.4k forks source link

Marking a file as "complete" when you autoProcessQueue=false and are capturing the .accept() event #594

Open PaulMcGuinness opened 3 years ago

PaulMcGuinness commented 3 years ago

Hi,

I'm capturing the dropzone accept event in the options like (code below) and have "autoProcessQueue" set to 'false' as I need a BLOB to pass another function.

I've spent ages looking, but can't see how I trigger the appropriate event to remove the % bar and show the tick (file upload complete)

Can someone point me in the right direction?

Cheers,

Paul

dropzoneLocalOptions: {
  url: "#",
  thumbnailWidth: 150,
  maxFilesize: 20000,
  autoProcessQueue : false,
  accept: function(file, done) {
                 var reader = new FileReader();
                reader.addEventListener("loadend", function(event) { 
                    this.bs_blob = new Blob([event.target.result], {type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"},"migrationPlan.xlsx");   
                  }.bind(this)); // Bind "Data" from anon function (from Vue)
                reader.readAsArrayBuffer(file);
                file.upload.progress=100;
                file.upload.bytesSent = file.upload.total;
                done();
              }.bind(this) // Bind "Data" from Vue