Home > Enterprise >  Img src in Storage link using v-for not working in Laravel vuejs
Img src in Storage link using v-for not working in Laravel vuejs

Time:12-29

I created the image directory using php artisan storage:link but when I tried calling the image src inside the v-for it doesn't display anything at all.

When I tried the static URL, it works-

<img width="300px" v-else src="{{ url('storage/images/validations/20221013192153-cvd-card-image-160310009-0155-00161.png') }}" alt="Red dot"  />

But when I tried this in a for loop, it was not working.

<div   v-for="(emv, index) in emvdetailsdata" :key="emv.evd_id">
 <img width="300px" v-else src="{{ url('storage/images/validations/emv.card_image') }}" alt="Red dot"  />
</div>

I also tried, :src, but nothing worked.

Any help would be great.

CodePudding user response:

You can simply pass the variable like this:

 <img :src="'/storage/images/validations/' emv.card_image" />
  • Related