0๐
I think this should work:
let posts = this.posts;
if (typeof this.checkedTags !== 'undefined' && this.checkedTags.length > 0) {
posts = posts.filter(post => {
return post.tags.some(tag => checkedTags.includes(tag.name))
})
}
Basically it will just filter all the posts where at least one tag is in the checkedTags
array. Depending on your needs you can also check if all the tags
of the post are there with post.tags.every()
- [Vuejs]-Axios โ Redirect to controller with data
- [Vuejs]-Resources in dist not work properly in production
Source:stackexchange.com