Files
yphsalumni.org/app/components/index/Events.vue
xiaomai dbd1abdc1c 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-15 17:58:00 +08:00

43 lines
1.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<!-- 活动模块 -->
<UPageSection title="校友活动" class="bg-gray-100">
<UPageGrid>
<div
v-for="event in events"
:key="event.id"
class="bg-white shadow rounded-xl"
>
<img
:src="event.cover"
:alt="event.title"
class="w-full aspect-[16/9] object-cover rounded-t-xl"
/>
<div class="p-6">
<h4 class="font-semibold text-lg mb-2">{{ event.title }}</h4>
<p class="text-sm text-gray-600 mb-1">
日期{{ useChineseDateFormat(event.date) }}
</p>
<p class="text-sm text-gray-600 mb-4">地点{{ event.location }}</p>
<UButton
label="阅读详情"
:to="event.path"
trailing-icon="mdi:book-open-blank-variant-outline"
/>
</div>
</div>
</UPageGrid>
</UPageSection>
</template>
<script lang="ts" setup>
const { data: events } = await useAsyncData("events", () =>
queryCollection("events")
.where("draft", "=", false)
.order("date", "DESC")
.limit(3)
.all()
);
</script>
<style></style>