If you use ES6, the Javascript ES6 arrow function should do the trick and you should be able to access this:
cropImage() {
this.$refs.cropper.getCroppedCanvas().toBlob(blob => {
this.data = blob;
});
},
Otherwise, something like this should work:
cropImage() {
var self = this;
this.$refs.cropper.getCroppedCanvas().toBlob(function (blob) {
self.data = blob;
});
},
For some explanation, you can check: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions