<script setup lang="ts">
import type { PostDetail } from '@/models'
import { formateDateAccurateToDay } from '@/utils'

const props = defineProps<{
  target: PostDetail
}>()
</script>

<template>
  <div>
    <div class="post-item">
      <h1 class="title">{{ props.target.title }}</h1>
      <div class="meta">
        <span class="date">{{ formateDateAccurateToDay(props.target.createdAt) }}</span>
        <span v-show="props.target.updatedAt !== props.target.createdAt" class="date">已更新于 {{ formateDateAccurateToDay(props.target.updatedAt) }}</span>
        <span class="cate">{{ props.target.cate }}</span>
      </div>
      <p>{{ props.target.content }}</p>
    </div>
  </div>
</template>

<style scoped></style>
