I've been triying to return a string in a reader.onloadend but it keeps me returning my entire function.
my function below:
uploadFile() {
let vm = this;
var file = vm.$refs["testeLogo"].files[0];
var reader = new FileReader();
reader.onloadend = function() {
console.log(reader.result); // returns me a string base64
document.querySelector("#supe").setAttribute("src", this.imagem);
return reader.result;
};
reader.readAsDataURL(file);
}
How can I return the value of the string in a proper way, because it keeps returning my own function instead of the reader.result that is printed on the console.log