0👍
photos
is an array:
<img :src="'/img/rooms/'+room.photos[0].name" class="card-img-top br0" :alt="room.photos[0].name">
Or you can iterate:
<img v-for="photo in room.photos" :src="'/img/rooms/'+photo.name" class="card-img-top br0" :alt="photo.name">
- [Vuejs]-Laravel return Unexpected token error when i use vuex
- [Vuejs]-Vuex dispatch creates significant overhead
0👍
photos
is an Array of objects. Hence, Elements should be access via index.
You have to add one more iteration for photos via v-for
.
<img v-for="photo in room.photos"
:key="photo.id"
:src="`/img/rooms/${photo.name}`"
class="card-img-top br0"
:alt="photo.name"
/>
-4👍
The image tag should be something like this:
<img src="/img/rooms/{{room.photos.name}}" alt="">
Source:stackexchange.com