2016-03-31 09:40:55 +08:00
|
|
|
---
|
|
|
|
order: 0
|
2016-06-19 11:17:09 +08:00
|
|
|
title:
|
|
|
|
zh-CN: 基本
|
|
|
|
en-US: Basic
|
2016-03-31 09:40:55 +08:00
|
|
|
---
|
2015-12-10 16:12:10 +08:00
|
|
|
|
2016-06-19 11:17:09 +08:00
|
|
|
## zh-CN
|
|
|
|
|
2016-11-11 12:08:18 +08:00
|
|
|
最简单的用法,在浮层中可以选择或者输入日期。
|
2015-12-10 16:12:10 +08:00
|
|
|
|
2016-06-19 11:17:09 +08:00
|
|
|
## en-US
|
|
|
|
|
2016-11-11 12:08:18 +08:00
|
|
|
Basic use case. Users can select or input a date in panel.
|
2016-06-19 11:17:09 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
```tsx
|
|
|
|
import type { DatePickerProps } from 'antd';
|
2020-08-06 15:10:00 +08:00
|
|
|
import { DatePicker, Space } from 'antd';
|
2022-05-21 22:14:15 +08:00
|
|
|
import React from 'react';
|
2018-06-27 15:55:04 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const onChange: DatePickerProps['onChange'] = (date, dateString) => {
|
2020-08-06 15:10:00 +08:00
|
|
|
console.log(date, dateString);
|
2022-05-19 09:46:26 +08:00
|
|
|
};
|
2015-12-25 01:21:03 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const App: React.FC = () => (
|
2020-08-06 15:10:00 +08:00
|
|
|
<Space direction="vertical">
|
|
|
|
<DatePicker onChange={onChange} />
|
|
|
|
<DatePicker onChange={onChange} picker="week" />
|
|
|
|
<DatePicker onChange={onChange} picker="month" />
|
|
|
|
<DatePicker onChange={onChange} picker="quarter" />
|
|
|
|
<DatePicker onChange={onChange} picker="year" />
|
2022-04-03 23:27:45 +08:00
|
|
|
</Space>
|
2018-11-28 15:00:03 +08:00
|
|
|
);
|
2022-05-19 09:46:26 +08:00
|
|
|
|
|
|
|
export default App;
|
2019-05-07 14:57:32 +08:00
|
|
|
```
|