]>
Commit | Line | Data |
---|---|---|
1 | /* eslint no-console:0 */ | |
2 | ||
3 | import 'rc-time-picker/assets/index.less'; | |
4 | ||
5 | import React from 'react'; | |
6 | import ReactDom from 'react-dom'; | |
7 | ||
8 | import moment from 'moment'; | |
9 | ||
10 | import TimePicker from 'rc-time-picker'; | |
11 | ||
12 | const showSecond = true; | |
13 | const str = showSecond ? 'HH:mm:ss' : 'HH:mm'; | |
14 | ||
15 | function onChange(value) { | |
16 | console.log(value && value.format(str)); | |
17 | } | |
18 | ||
19 | ReactDom.render( | |
20 | <TimePicker | |
21 | format={str} | |
22 | showSecond={showSecond} | |
23 | // use to control utfOffset, locale, default open value | |
24 | defaultOpenValue={moment()} | |
25 | className="xxx" | |
26 | onChange={onChange} | |
27 | disabledHours={() => [0, 1, 2, 3, 4, 5, 6, 7, 8, 22, 23]} | |
28 | disabledMinutes={() => [0, 2, 4, 6, 8]} | |
29 | hideDisabledOptions | |
30 | />, | |
31 | document.getElementById('__react-content') | |
32 | ); |