1 回答
TA贡献1821条经验 获得超6个赞
你通过添加一个额外t的v-show="pictToShow == index"should be 来打错字v-show="picToShow == index",但我发现制作两个循环不是一个好习惯,我建议保留第一个并使用选定的索引来显示它的图像:src="pictures[picToShow].picture_1":
<div class="col-md-6">
<div class="row" id="grid">
<div v-for="(picture, index) in pictures"
:key="picture.pk"
class="col-md-4 my-auto"
>
<div @click="picToShow= index">
<img class="img-thumbnail img-responsive" :src="picture.picture_1">
</div>
</div>
</div>
</div>
<div class="col-6 text-center my-auto">
<div v-if="picToShow!==null" class="col-md-4 my-auto">
<img :src="pictures[picToShow].picture_1" />
</div>
</div>
添加回答
举报