【发布时间】:2021-08-21 18:53:30
【问题描述】:
我创建了一个存储所有游戏的数据库。在 js 部分,我发送了一个获取所有游戏的请求,然后将结果放入 games[] 列表中。 当我尝试分配存储在 db 中的图像时,在 js games[index]['cover_img'] 中,它们没有显示。
<div class="all_games">
<div class="game" v-for='(val, index) in games' :key='index'>
<img :scr="getImg(index)" alt='game'>
<h2> {{games[index]['title']}}</h2>
<h2> {{games[index]['price'] + conc}} </h2>
<input v-if=(checkAvailable(index)) type='submit' class=' pointer ' name='submit' value='Add to cart' @click='addGame' />
<p v-else> OUT OF STOCK </p>
</div>
我尝试使用函数 getImg 访问图像:
getImg(index){
return '/static/images/store/'+ this.games[index]['cover_img'];
},
但他们没有显示。我该如何解决这个问题?
【问题讨论】:
标签: javascript sqlite vue.js flask