[+] Implement post filtering

This commit is contained in:
Hykilpikonna
2021-12-26 20:30:14 -05:00
parent 9efac31261
commit ea8ffeeddc
+7 -1
View File
@@ -1,6 +1,6 @@
<template>
<div id="Blog">
<BlogPostPreview v-for="m of meta.posts" :key="m" :meta="m"/>
<BlogPostPreview v-for="m of filteredPosts" :key="m" :meta="m"/>
</div>
</template>
@@ -32,6 +32,12 @@ export default class Blog extends Vue
this.meta = it
})
}
get filteredPosts(): BlogPostMeta[]
{
return this.meta.posts.filter(it => it.pinned || (this.tag ? it.tags.includes(this.tag) :
this.category ? it.category == this.category : true))
}
}
</script>