Files
yphsalumni.org/app/pages/events/index.vue
xiaomai 6288a1b01b feat(content): add draft support for content collections
This commit introduces a draft system for the 'events' and 'news' collections. A `draft` boolean field has been added to the content schema, and frontend queries are now updated to only fetch and
display content where `draft` is `false`. This allows content to be created and saved without being publicly visible, improving the publishing workflow.
2025-11-27 17:53:42 +08:00

35 lines
760 B
Vue

<template>
<UPage>
<UPageBody>
<UContainer>
<UChangelogVersions :versions="newsPost" />
</UContainer>
</UPageBody>
</UPage>
</template>
<script lang="ts" setup>
import type { ChangelogVersionProps } from "@nuxt/ui";
const { data: events } = await useAsyncData("events", () =>
queryCollection("events")
.where("draft", "=", false)
.order("date", "DESC")
.limit(3)
.all()
);
// 将 news 数据转换成 UBlogPosts 可用格式
const newsPost = computed<ChangelogVersionProps[]>(() =>
(events.value || []).map((evt: any) => ({
title: evt.title,
description: evt.description,
image: evt.cover,
date: evt.date,
to: evt.path, // ✅ 建议加路由跳转
}))
);
</script>
<style></style>