I'm currently facing an issue with the code below
When I try to console.log image.Url in the outer function, it returns null even though it should return a string from the reader.onload function
Here is the complete code snippet:
export default {
data() {
return {
item: {
image: null
},
imageUrl: null,
};
},
methods: {,
uploadImage(e) {
let image = e.target.files[0];
const reader = new FileReader();
reader.readAsDataURL(image);
reader.onload = function(){
this.imageUrl = reader.result
console.log(this.imageUrl)
// this.setImageOne(this.imageUrl)
}
console.log(this.imageUrl)
},
Issue has been resolved. Thank you for all the assistance.