feat(settings/clock/date): intro and outro animation
This commit is contained in:
@@ -12,11 +12,37 @@ useIntervalFn(() => {
|
|||||||
now.value = new Date();
|
now.value = new Date();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
const handleCancel = () => {
|
const monthRef = useTemplateRef<InstanceType<typeof NumberInput>>("month");
|
||||||
|
const dayRef = useTemplateRef<InstanceType<typeof NumberInput>>("day");
|
||||||
|
const yearRef = useTemplateRef<InstanceType<typeof NumberInput>>("year");
|
||||||
|
|
||||||
|
const animateIntro = async () => {
|
||||||
|
await Promise.all([
|
||||||
|
monthRef.value?.animateIntro(),
|
||||||
|
dayRef.value?.animateIntro(),
|
||||||
|
yearRef.value?.animateIntro(),
|
||||||
|
]);
|
||||||
|
};
|
||||||
|
|
||||||
|
const animateOutro = async () => {
|
||||||
|
await Promise.all([
|
||||||
|
monthRef.value?.animateOutro(),
|
||||||
|
dayRef.value?.animateOutro(),
|
||||||
|
yearRef.value?.animateOutro(),
|
||||||
|
]);
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
animateIntro();
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleCancel = async () => {
|
||||||
|
await animateOutro();
|
||||||
store.closeSubMenu();
|
store.closeSubMenu();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleConfirm = () => {
|
const handleConfirm = async () => {
|
||||||
|
await animateOutro();
|
||||||
store.closeSubMenu();
|
store.closeSubMenu();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -29,18 +55,21 @@ defineOptions({ render: () => null });
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<NumberInput
|
<NumberInput
|
||||||
|
ref="month"
|
||||||
:model-value="now.getMonth() + 1"
|
:model-value="now.getMonth() + 1"
|
||||||
:title="$t('settings.clock.date.month')"
|
:title="$t('settings.clock.date.month')"
|
||||||
:x="1 * 16 - 1"
|
:x="1 * 16 - 1"
|
||||||
:disabled="true"
|
:disabled="true"
|
||||||
/>
|
/>
|
||||||
<NumberInput
|
<NumberInput
|
||||||
|
ref="day"
|
||||||
:model-value="now.getDate()"
|
:model-value="now.getDate()"
|
||||||
:title="$t('settings.clock.date.day')"
|
:title="$t('settings.clock.date.day')"
|
||||||
:x="5 * 16 - 1"
|
:x="5 * 16 - 1"
|
||||||
:disabled="true"
|
:disabled="true"
|
||||||
/>
|
/>
|
||||||
<NumberInput
|
<NumberInput
|
||||||
|
ref="year"
|
||||||
:model-value="now.getFullYear()"
|
:model-value="now.getFullYear()"
|
||||||
:title="$t('settings.clock.date.year')"
|
:title="$t('settings.clock.date.year')"
|
||||||
:digits="4"
|
:digits="4"
|
||||||
|
|||||||
Reference in New Issue
Block a user