2015-05-27 20:41:16 +08:00
|
|
|
# 选择日期
|
2015-05-26 13:58:35 +08:00
|
|
|
|
2015-05-27 20:41:16 +08:00
|
|
|
- order: 2
|
2015-06-02 17:20:02 +08:00
|
|
|
|
2015-10-12 17:53:01 +08:00
|
|
|
通过设置选择日期的回调事件 `onChange`,完成交互行为。
|
2015-05-26 13:58:35 +08:00
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
````jsx
|
2015-10-28 20:55:49 +08:00
|
|
|
import { Datepicker } from 'antd';
|
2015-05-26 13:58:35 +08:00
|
|
|
|
2015-10-28 20:55:49 +08:00
|
|
|
const Picker = React.createClass({
|
2015-05-26 13:58:35 +08:00
|
|
|
handleChange: function(value) {
|
|
|
|
console.log(new Date(value.getTime()));
|
|
|
|
},
|
|
|
|
render: function() {
|
2015-11-25 17:35:49 +08:00
|
|
|
return <Datepicker onChange={this.handleChange} />;
|
2015-05-26 13:58:35 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-10-20 16:47:55 +08:00
|
|
|
ReactDOM.render(
|
2015-05-26 13:58:35 +08:00
|
|
|
<Picker />
|
|
|
|
, document.getElementById('components-datepicker-demo-select'));
|
|
|
|
````
|