I have been working on displaying and modifying images of a car in my project. To achieve this, I utilized the vue-upload-multiple-image package for storing the images successfully. However, I encountered an issue when trying to retrieve these stored images using the same package. I converted the saved images to base64 format, and now my goal is to pass the list of images to a specific function within the package. This function will handle displaying the images when updating the car details.
Below is the function I need to invoke:
createImage(file) {
let reader = new FileReader()
let formData = new FormData()
formData.append('file', file)
reader.onload = e => {
let dataURI = e.target.result
if (dataURI) {
if (!this.images.length) {
this.images.push({
name: file.name,
path: dataURI,
highlight: 1,
default: 1,
})
this.currentIndexImage = 0
} else {
this.images.push({
name: file.name,
path: dataURI,
highlight: 0,
default: 0,
})
}
this.$emit(
'upload-success',
formData,
this.images.length - 1,
this.images,
)
}
}
reader.readAsDataURL(file)
},
Link to the function in this file
When attempting to console.log the function, it returns undefined. I have considered using props but am unsure how it can assist me.
mounted(){
console.log(this.createImage);
My aim is to simply call this function within my editcar component and provide it with the converted images. Your assistance in solving this issue is greatly appreciated. Thank you for reading this far.