32 lines
886 B
Vue
32 lines
886 B
Vue
<script setup>
|
|
const { data: posts } = await useFetch('/api/posts', {
|
|
default: () => []
|
|
})
|
|
|
|
const postCards = computed(() => posts.value.map((post) => ({
|
|
title: post.title,
|
|
excerpt: post.excerpt,
|
|
featuredImage: post.featuredImage,
|
|
tag: post.tags?.[0] ? String(post.tags[0]).toUpperCase() : '',
|
|
publishedAt: formatPostDate(post.publishedAt),
|
|
to: `/post/${post.slug}`
|
|
})))
|
|
</script>
|
|
|
|
<template>
|
|
<MainColumn>
|
|
<section class="posts-index site-section">
|
|
<div class="posts-index__header site-section-header">
|
|
<p class="posts-index__eyebrow text-xs font-semibold uppercase text-muted">
|
|
Posts
|
|
</p>
|
|
<h1 class="posts-index__title mt-3 text-4xl font-semibold leading-tight">
|
|
게시물
|
|
</h1>
|
|
</div>
|
|
</section>
|
|
|
|
<PostCard v-for="post in postCards" :key="post.to" :post="post" />
|
|
</MainColumn>
|
|
</template>
|