0
I’m starting to use Vuejs and I’m developing a game, but I can’t load the saved images on my PC in the game interface. Someone can fix this?
Here’s what I’ve tried so far:
<div class="row">
<div class="col-6">
<a href="#" @click.prevent="selectCart">
<img src="virada.png" alt="baralho" class="carts">
</a>
</div>
<div class="col-6">
<div v-if="cartSelected =! ''">
<img :src="'' + cartSelected +'.png'" alt="carta" class="cart">
</div>
</div>
src of the first img tag is looking for an image in the same folder that the file that this code is in. Try to put the entire path of the directory where the image is if it is not in the same place from where the file is.
– Sumback
I already did, I specified the path but it still didn’t work <img :src="'Assets/carts/' + cartSelected +'. png'" alt="letter" class="Cart">
– jessie
@jessie use
<img :src="require('@/assets/carts/' + cartSelected + '.png')" />
– Valdeir Psr