ant-design/components/date-picker/demo/basic.md

38 lines
682 B
Markdown
Raw Normal View History

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
---
2016-06-19 11:17:09 +08:00
## zh-CN
最简单的用法,在浮层中可以选择或者输入日期。
2016-06-19 11:17:09 +08:00
## en-US
Basic use case. Users can select or input a date in panel.
2016-06-19 11:17:09 +08:00
2019-05-07 14:57:32 +08:00
```jsx
2017-01-04 11:07:49 +08:00
import { DatePicker } from 'antd';
2018-06-27 15:55:04 +08:00
const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
function onChange(date, dateString) {
console.log(date, dateString);
}
ReactDOM.render(
<div>
2016-11-23 11:23:18 +08:00
<DatePicker onChange={onChange} />
<br />
2017-02-15 16:32:20 +08:00
<MonthPicker onChange={onChange} placeholder="Select month" />
2016-11-23 11:23:18 +08:00
<br />
<RangePicker onChange={onChange} />
<br />
<WeekPicker onChange={onChange} placeholder="Select week" />
2018-06-27 15:55:04 +08:00
</div>,
2019-05-07 14:57:32 +08:00
mountNode,
2018-11-28 15:00:03 +08:00
);
2019-05-07 14:57:32 +08:00
```