[+] Implement post filtering
This commit is contained in:
+7
-1
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="Blog">
|
<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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -32,6 +32,12 @@ export default class Blog extends Vue
|
|||||||
this.meta = it
|
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>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user