<template>
<div>
<div class='tags'>
<a v-for="item in tags" @click.prevent="activeTagId = item.id">{item.name}</a>
</div>
<div class="videos">
<div v-for="item in videos" v-show="isViewVideo(item)">...</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
activeTagId: null,
tags: [
{
id: 1,
name: '',
},
],
videos: [
{
id: 1,
name: '',
tagIds: [1,2,3],
},
],
};
},
methods: {
isViewVideo(video) {
return video.tagIds && video.tagIds.indexOf(this.activeTagId) >= 0;
},
},
}
</script>