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