0👍
You’ve to bind variable data into your src
as follow
<div v-for="(p,i) in products" :key="i">
<img :src="`./assets/room${str(i)}.jpg`" class = "room-img">
<h4 @click="modelFlag = true">{{products[i]}}</h4>
<p>{{prices[i]}}</p>
<button @click="increase(i)">sign</button>
You can perform/do above as follow too:
:src="'./assets/room'+str(i)+'.jpg'"
And it will works.
:src
and v-bind:src
work in same way
Reference
- [Vuejs]-Inertia detect api request 303 in nuxt js and laravel
- [Vuejs]-Resetting global state of composable between tests
Source:stackexchange.com