I'm having some problems rendering an image in a HTML element. I think the solution might be simple for experienced front end devs. I have a Vuetify component that lets user input a profile image:
<v-form>
<v-avatar size="144">
<v-icon hidden ref="default_icon" size="144">account_circle</v-icon>
<img ref="my_img" style="display: none;" :src="my_photo.name">
<v-btn @click="$refs.my_input.click()" class="img_btn" absolute right small fab dark color="pink">
<v-icon dark>add</v-icon>
</v-btn>
<input ref="my_input" hidden type="file" accept="image/*" @change="onFileChange($refs.my_input)">
</v-avatar>
</v-form>
When the element calls onFileChange it pass the HTML element to the function.
onFileChange(event) {
this.my_photo = event.files[0]
console.log(this.my_photo)
this.$refs.default_icon.style.display = "none"
this.$refs.my_img.style.display = "inline"
}
So now the function replaces the icon with the img tag. I want to fill the image tag with the image that the user inputs. this.my_photo is a File type variable. Does anyone know how to do this? Regards for everyone!