feat: migrate Calendar and calendar year picker

This commit is contained in:
maoyingjie
2026-10-24 20:59:19 +08:00
parent 1c4ecc3def
commit 835d2e4d90
47 changed files with 4283 additions and 87 deletions
+67
View File
@@ -0,0 +1,67 @@
<script setup lang="ts">
import {
Calendar,
CalendarHeader,
CalendarHeading,
CalendarNavButton,
CalendarGrid,
CalendarGridHeader,
CalendarGridBody,
CalendarHeaderCell,
CalendarCell,
Select,
SelectTrigger,
SelectValue,
SelectIndicator,
SelectPopover,
ListBox,
ListBoxItem,
ListBoxItemIndicator,
Label,
} from "@heroui-vue/components";
import { ref } from "vue";
const duration = ref("5");
const options = [1, 5, 7, 8, 10, 14, 21];
</script>
<template>
<div class="flex flex-col items-center gap-6">
<Select v-model="duration" class="w-40">
<Label>可见天数</Label>
<SelectTrigger>
<SelectValue />
<SelectIndicator />
</SelectTrigger>
<SelectPopover>
<ListBox>
<ListBoxItem
v-for="option in options"
:key="option"
:id="String(option)"
:text-value="`${option} 天`"
>
{{ option }} 天
<ListBoxItemIndicator />
</ListBoxItem>
</ListBox>
</SelectPopover>
</Select>
<Calendar
aria-label="日视图"
:visible-duration="{ days: Number(duration) }"
>
<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>
</div>
</template>