Files
zhdiary/packages/nuxt/components/PostTeaser.vue
T
2020-12-16 01:12:41 +07:00

49 lines
922 B
Vue

<template>
<section>
<h2>
<nuxt-link :to="'post/' + post.path">
{{ post.title }}
</nuxt-link>
</h2>
<small>
<span>
by
<a
v-if="theme.author.url"
:href="theme.author.url"
target="_blank"
rel="noopener"
>
{{ theme.author.name }}
</a>
<span v-else>
{{ theme.author.name }}
</span>
</span>
<span v-if="post.date" style="float: right">
{{ post.date | formatDate }}
</span>
</small>
<article v-html="post.excerpt"></article>
</section>
</template>
<script lang="ts">
import { Vue, Component, Prop } from 'nuxt-property-decorator'
import { THEME } from '~/assets/global'
@Component
export default class PostTeaser extends Vue {
@Prop() post!: IPostTeaser
theme = THEME
}
</script>
<style scoped>
article {
margin-top: 2em;
}
</style>