ant-design-vue/components/calendar/demo/select.vue

48 lines
961 B
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<docs>
---
order: 3
title:
zh-CN: ้€‰ๆ‹ฉๅŠŸ่ƒฝ
en-US: Selectable Calendar
---
## zh-CN
ไธ€ไธช้€š็”จ็š„ๆ—ฅๅކ้ขๆฟ๏ผŒๆ”ฏๆŒๅนด/ๆœˆๅˆ‡ๆขใ€‚
## en-US
A basic calendar component with Year/Month switch.
</docs>
<template>
<a-alert :message="`You selected date: ${selectedValue && selectedValue.format('YYYY-MM-DD')}`" />
<a-calendar :value="date" @select="onSelect" @panelChange="onPanelChange" />
</template>
<script lang="ts">
import { defineComponent, ref } from 'vue';
import dayjs, { Dayjs } from 'dayjs';
export default defineComponent({
setup() {
const date = ref(dayjs('2017-01-25'));
const selectedValue = ref(dayjs('2017-01-25'));
const onSelect = (value: Dayjs) => {
date.value = value;
selectedValue.value = value;
};
const onPanelChange = (value: Dayjs) => {
date.value = value;
};
return {
date,
selectedValue,
onSelect,
onPanelChange,
};
},
});
</script>