2016-03-31 09:40:55 +08:00
|
|
|
---
|
|
|
|
order: 0
|
2016-09-09 13:55:21 +08:00
|
|
|
title:
|
2016-05-22 11:03:07 +08:00
|
|
|
zh-CN: 基本
|
|
|
|
en-US: Basic
|
2016-03-31 09:40:55 +08:00
|
|
|
---
|
2015-11-11 00:15:12 +08:00
|
|
|
|
2016-05-22 11:03:07 +08:00
|
|
|
## zh-CN
|
|
|
|
|
2015-11-13 18:20:22 +08:00
|
|
|
一个通用的日历面板,支持年/月切换。
|
2015-11-11 00:15:12 +08:00
|
|
|
|
2016-05-22 11:03:07 +08:00
|
|
|
## en-US
|
|
|
|
|
|
|
|
A basic calendar component with Year/Month switch.
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
```tsx
|
2015-11-11 00:15:12 +08:00
|
|
|
import { Calendar } from 'antd';
|
2022-07-04 22:09:54 +08:00
|
|
|
import type { CalendarMode } from 'antd/es/calendar/generateCalendar';
|
2022-05-19 09:46:26 +08:00
|
|
|
import type { Moment } from 'moment';
|
2022-05-23 14:37:16 +08:00
|
|
|
import React from 'react';
|
2015-11-11 00:15:12 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const App: React.FC = () => {
|
|
|
|
const onPanelChange = (value: Moment, mode: CalendarMode) => {
|
|
|
|
console.log(value.format('YYYY-MM-DD'), mode);
|
|
|
|
};
|
2015-11-11 00:15:12 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
return <Calendar onPanelChange={onPanelChange} />;
|
|
|
|
};
|
|
|
|
|
|
|
|
export default App;
|
2019-05-07 14:57:32 +08:00
|
|
|
```
|