1 回答

TA貢獻(xiàn)1821條經(jīng)驗(yàn) 獲得超6個(gè)贊
你通過添加一個(gè)額外t的v-show="pictToShow == index"should be 來打錯(cuò)字v-show="picToShow == index",但我發(fā)現(xiàn)制作兩個(gè)循環(huán)不是一個(gè)好習(xí)慣,我建議保留第一個(gè)并使用選定的索引來顯示它的圖像: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>
添加回答
舉報(bào)