1
Someone could explain to me why I’m not able to render the image on the screen. I’m using the Vue-cli and the image is in the folder Assets inside the briefcase src normal, but when I call her in the template does not load. I have tried so: ./assets/produto.png
, thus: ../assets/produto.png
, thus: src/assets/produto.png
. But to no avail!
Template:
<div>
<img :src="imagem" :alt="alt">
</div>
Script:
data () {
return {
imagem: './assets/produto.png',
alt: 'Imagens dos produtos.'
}
}
Any errors in Chrome tools?
– Hiago Souza
@Hiagosouza No guy at all.
– LeAndrade
When inspecting element which content displayed in the img tag?
– Hiago Souza
You can post the complete code with your controller?
– Hiago Souza
@Hiagosouza Cara I managed to solve here, Vue-cli creates a folder Assets and plays the images inside it, only tbm creates another folder called Static at the same level as Assets and the images have to be inserted in this Static folder.
– LeAndrade
Topp! That’s right, put the solution as a response to the community. Hug.
– Hiago Souza
Tried so?
imagem: '~assets/produto.png'
– Marconi
@Marconi so tbm was not man. With me it just worked taking the images from the folder Assets and putting in the same Static folder.
– LeAndrade