mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-25 11:40:04 +08:00
resume date time demo
This commit is contained in:
parent
2e54c5b30d
commit
8d85684b12
@ -2,26 +2,14 @@
|
||||
|
||||
- order: 4
|
||||
|
||||
和 [时间选择组件](/components/timepicker) 配合使用。
|
||||
准确到秒的时间选择面板。
|
||||
|
||||
---
|
||||
|
||||
````jsx
|
||||
import { Datepicker, Timepicker } from 'antd';
|
||||
import { Datepicker } from 'antd';
|
||||
|
||||
function onDateChange(date) {
|
||||
console.log(date.toLocaleDateString());
|
||||
}
|
||||
|
||||
function onTimeChange(time) {
|
||||
console.log(time.toLocaleTimeString());
|
||||
console.log('时', time.getHours());
|
||||
console.log('分', time.getMinutes());
|
||||
console.log('秒', time.getSeconds());
|
||||
}
|
||||
|
||||
ReactDOM.render(<div>
|
||||
<Datepicker onChange={onDateChange} />
|
||||
<Timepicker onChange={onTimeChange} />
|
||||
</div>, document.getElementById('components-datepicker-demo-time'));
|
||||
ReactDOM.render(
|
||||
<Datepicker showTime={true} format="yyyy-MM-dd HH:mm:ss" defaultValue="2015-11-11 11:11:11"/>
|
||||
, document.getElementById('components-datepicker-demo-time'));
|
||||
````
|
||||
|
@ -25,6 +25,7 @@
|
||||
| format | 展示的日期格式 | string | "yyyy-MM-dd" |
|
||||
| disabledDate | 不可选择的日期 | function | 无 |
|
||||
| onChange | 时间发生变化的回调,发生在用户选择时间时 | function(Date value) | 无 |
|
||||
| showTime | 显示时间选择条 | boolean | false |
|
||||
| disabled | 禁用 | bool | false |
|
||||
| calendarStyle | 格外的弹出日历样式,例如 zIndex | object | {} |
|
||||
| size | 输入框大小,`large` 高度为 32px,`small` 为 22px,默认是 28px | string | 无 |
|
||||
|
@ -10,10 +10,7 @@
|
||||
import { Timepicker } from 'antd';
|
||||
|
||||
function onChange(time) {
|
||||
console.log(time.toLocaleTimeString());
|
||||
console.log('时', time.getHours());
|
||||
console.log('分', time.getMinutes());
|
||||
console.log('秒', time.getSeconds());
|
||||
console.log(time.toTimeString());
|
||||
}
|
||||
|
||||
ReactDOM.render(
|
||||
|
Loading…
Reference in New Issue
Block a user