I'd like to access a VueJS variable from the success
Dropzone event callback.
All the code is OK, DropzoneJS & VueJS work fine together, but my variable photos
is not accessible in the success callback.
Here is a simple implementation of my script :
<script>
import Dropzone from 'dropzone';
export default {
data() {
return {
photos: []
};
},
ready() {
Dropzone.autoDiscover = false;
new Dropzone('form#upload-form', {
url: '...',
success: function(file, response) {
this.photos = response.data.photos;
// this.photos is not accessible here
}
});
}
}
</script>
Is there a best practice to access VueJS components variables this way? Thanks