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

trying to log the response from api after file is uploaded #541

Closed JanMoo closed 4 years ago

JanMoo commented 4 years ago
`<template>
  <vue-dropzone ref="myVueDropzone" id="dropzone" 
  :options="dropzoneOptions" @vdropzone-succes="afterComplete">
  </vue-dropzone>
</template>

<script>
//https://rowanwins.github.io/vue-dropzone/docs/dist/index.html#/events
//dropzone
import vue2Dropzone from 'vue2-dropzone'
import 'vue2-dropzone/dist/vue2Dropzone.min.css'
export default {
  name: 'FileUpload',
  components: {
    vueDropzone: vue2Dropzone,
  },
  data: function () {
    return {
      dropzoneOptions: {
          url: 'http://headcount.test/wp-json/recruiter/v1/upload',
          thumbnailWidth: 150,
          maxFilesize: 0.5,
          headers: { "Content-Type": "multipart/form-data;" },
      },
    }
  },
    methods:{ 
    afterComplete(file) {
      console.log(file.xhr.response);

    },
  },
}
</script>
`

this is my code, as far as I know I followed the docs it doesn't log anything i also tried console.log("succes") didn't do anything

Fanatic17 commented 4 years ago

I'm trying to do this too. I think you misspelled " @vdropzone-succes" should be @vdropzone-success

rowanwins commented 4 years ago

Yep thats my suggestion too - thanks @Fanatic17