I have a list of tags and a list of selected tags:
data () {
return {
tags: ['#tag1', '#tag2', '#tag3'],
selectTags: ['#tag1', '#tag2', '#tag3'],
images: {}
}
},
With them, I created a checkbox loop:
<div v-for="tag in tags" :key="tag">
<input type="checkbox" :id="tag" :value="tag" v-model="selectTags" checked>
<label :for="tag">{{ tag }}</label>
</div>
This tags is used as keys in a list of images. I would like to show/hide image based on select Tags list. If this image key in on the list, the image show. Otherwise, it's will be hidden.
<template v-for="(tag, index) in images" v-show="selectTags.includes(index)">
<figure class="thumb" v-for="path in tag['best']['paths']" :key="path">
<img :src="path | formatImageURL" alt="">
</figure>
</template>
This not works when page loaded and when I uncheck a tag.