1

I am trying to display an image on my slider which i have on assets folder but i cant do it.

My folder Structure is like this

I am On home.vue

My code looks like this

home.vue <img src="../images/firstslide.png"/> 

The file is compiled i think also the image:

"images/firstslide.png?b20d27e52e45509537b8713af8b92eed 423 KiB [emitted]" 

But the image itself its now showing.

5
  • are you using vue-cli? or laravel? or nuxt? or ? Commented Apr 3, 2020 at 12:18
  • if you are using vue cli the asset path <img src="./image.png"> Commented Apr 3, 2020 at 12:25
  • Im using laravel yeah, no vue-cli or nuxt tried also ./image.png that doesnt work too Commented Apr 3, 2020 at 12:28
  • if it's laravel keep asset at laravel public folder then give path like this <img src="/image.png" alt=""> Commented Apr 3, 2020 at 12:41
  • Oh thanks, thats actually worked Commented Apr 3, 2020 at 12:47

1 Answer 1

1

Have you tried using require like this:

 <img :src="require('../images/firstslide.png')"/> 

Taken from: https://forum.vuejs.org/t/img-src-require-url-not-working/39704

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.