feat: migrate DateField and shared date input group

This commit is contained in:
maoyingjie
2026-10-23 23:56:18 +08:00
parent 3c878d2582
commit 01f0776805
63 changed files with 3974 additions and 90 deletions
+38
View File
@@ -0,0 +1,38 @@
<script setup lang="ts">
import {
DateField,
DateFieldGroup,
DateFieldInput,
DateFieldSegment,
Label,
Description,
Button,
} from "@heroui-vue/components";
import { shallowRef } from "vue";
import {
today,
getLocalTimeZone,
type DateValue,
} from "@internationalized/date";
const value = shallowRef<DateValue | null>(null);
const todayDate = today(getLocalTimeZone());
</script>
<template>
<div class="flex flex-col gap-4">
<DateField v-model="value" class="w-[256px]" name="date">
<Label>日期</Label>
<DateFieldGroup>
<DateFieldInput v-slot="{ segment }">
<DateFieldSegment :segment="segment" />
</DateFieldInput>
</DateFieldGroup>
<Description>
当前值:{{ value ? value.toString() : "(空)" }}
</Description>
</DateField>
<div class="flex gap-2">
<Button variant="tertiary" @click="value = todayDate">设为今天</Button>
<Button variant="tertiary" @click="value = null">清空</Button>
</div>
</div>
</template>