[+] Blog post model

This commit is contained in:
Hykilpikonna
2021-12-25 20:47:30 -05:00
parent 8a48294f4e
commit 803b7505fc
+44
View File
@@ -0,0 +1,44 @@
<template>
<div id="BlogPostPreview">
<div id="title">{{meta.title}}</div>
</div>
</template>
<script lang="ts">
import {Options, Vue} from 'vue-class-component';
import {Prop} from "vue-property-decorator";
import {hosts} from "@/scripts/constants";
import {marked} from "marked";
export interface BlogPostMeta
{
title: string
tags: string[]
file: string
date: string
subtitle?: string
title_image?: string
}
@Options({components: {}})
export default class BlogPostPreview extends Vue
{
@Prop({required: true}) meta!: BlogPostMeta
created(): void
{
if (!this.meta.subtitle)
{
fetch(`${hosts.content}/${this.meta.file}`).then(it => it.text()).then(it =>
{
this.meta.subtitle = marked(it)
})
}
}
}
</script>
<style lang="sass" scoped>
</style>