64 lines
1.7 KiB
Vue
64 lines
1.7 KiB
Vue
<script setup lang="ts">
|
||
import {
|
||
Calendar,
|
||
CalendarHeader,
|
||
CalendarHeading,
|
||
CalendarNavButton,
|
||
CalendarGrid,
|
||
CalendarGridHeader,
|
||
CalendarGridBody,
|
||
CalendarHeaderCell,
|
||
CalendarCell,
|
||
Button,
|
||
Description,
|
||
} from "@heroui-vue/components";
|
||
import { shallowRef } from "vue";
|
||
import { parseDate, type DateValue } from "@internationalized/date";
|
||
const focusedDate = shallowRef<DateValue>(parseDate("2025-06-15"));
|
||
</script>
|
||
<template>
|
||
<div class="flex flex-col items-center gap-4">
|
||
<Calendar aria-label="活动日期" v-model:focused-value="focusedDate">
|
||
<CalendarHeader>
|
||
<CalendarHeading />
|
||
<CalendarNavButton slot="previous" />
|
||
<CalendarNavButton slot="next" />
|
||
</CalendarHeader>
|
||
<CalendarGrid>
|
||
<CalendarGridHeader v-slot="{ day }">
|
||
<CalendarHeaderCell>{{ day }}</CalendarHeaderCell>
|
||
</CalendarGridHeader>
|
||
<CalendarGridBody v-slot="{ date }">
|
||
<CalendarCell :date="date" />
|
||
</CalendarGridBody>
|
||
</CalendarGrid>
|
||
</Calendar>
|
||
<Description class="text-center">
|
||
聚焦:{{ focusedDate.toString() }}
|
||
</Description>
|
||
<div class="flex flex-wrap justify-center gap-2">
|
||
<Button
|
||
size="sm"
|
||
variant="secondary"
|
||
@click="focusedDate = parseDate('2025-01-01')"
|
||
>
|
||
跳转到一月
|
||
</Button>
|
||
<Button
|
||
size="sm"
|
||
variant="secondary"
|
||
@click="focusedDate = parseDate('2025-06-15')"
|
||
>
|
||
跳转到六月
|
||
</Button>
|
||
<Button
|
||
size="sm"
|
||
variant="secondary"
|
||
@click="focusedDate = parseDate('2025-12-25')"
|
||
>
|
||
跳转到圣诞节
|
||
</Button>
|
||
</div>
|
||
</div>
|
||
</template>
|