68 lines
1.6 KiB
Vue
68 lines
1.6 KiB
Vue
<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>
|