I can't understand why this img-src is not working in my vue template. May be it's my simple mistake which I couldn't figure out.
And here is,
<b-card img-src="../assets/image.jpg" img-alt="Image" img-top tag="article" style="max-width: 20rem;">
I can't understand why this img-src is not working in my vue template. May be it's my simple mistake which I couldn't figure out.
And here is,
<b-card img-src="../assets/image.jpg" img-alt="Image" img-top tag="article" style="max-width: 20rem;">
here is one way to import the image to your vue-component:
import image from "@/assets/your_img.jpg";
export default {
data() {
return {
image
}
},
<b-card :img-src="image">
I think its beacause webpack generates a hash on the image path, eg. "/img/my_image.b1793a36.jpg". I guess thats why your first approach doesn't work. If you import the image, webpack will add a hash automaticlly and the path will reference to it.