diff options
author | MG12 <wuzhao.mail@gmail.com> | 2015-12-12 20:34:00 +0800 |
---|---|---|
committer | MG12 <wuzhao.mail@gmail.com> | 2015-12-12 20:34:00 +0800 |
commit | 518b852e8bd9c50a6c5c7e84cddecb5c94ebb5b6 (patch) | |
tree | 664ef5377589dc3c4def7e732dfaa76e89da1fb1 /examples/pick-time.js | |
parent | 182e9fccc90ae709322b7cc314c8775a9d8d46b8 (diff) | |
download | time-picker-518b852e8bd9c50a6c5c7e84cddecb5c94ebb5b6.tar.gz time-picker-518b852e8bd9c50a6c5c7e84cddecb5c94ebb5b6.tar.zst time-picker-518b852e8bd9c50a6c5c7e84cddecb5c94ebb5b6.zip |
add new options about disabled time
Diffstat (limited to 'examples/pick-time.js')
-rw-r--r-- | examples/pick-time.js | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/examples/pick-time.js b/examples/pick-time.js index dd5a2ce..074e72c 100644 --- a/examples/pick-time.js +++ b/examples/pick-time.js | |||
@@ -24,11 +24,27 @@ function onChange(value) { | |||
24 | console.log(value && formatter.format(value)); | 24 | console.log(value && formatter.format(value)); |
25 | } | 25 | } |
26 | 26 | ||
27 | const options = { | ||
28 | disabledHours() { | ||
29 | return [0, 2, 21]; | ||
30 | }, | ||
31 | disabledMinutes(h) { | ||
32 | return h === 22 ? [0, 3, 31] : []; | ||
33 | }, | ||
34 | disabledSeconds(h, m) { | ||
35 | return []; | ||
36 | }, | ||
37 | }; | ||
38 | |||
27 | ReactDom.render( | 39 | ReactDom.render( |
28 | <TimePicker formatter={formatter} locale={TimePickerLocale} | 40 | <TimePicker formatter={formatter} locale={TimePickerLocale} |
29 | showSecond={showSecond} | 41 | showSecond={showSecond} |
30 | defaultValue={now} | 42 | defaultValue={now} |
31 | className="xxx" | 43 | className="xxx" |
32 | onChange={onChange}/>, | 44 | onChange={onChange} |
45 | disabledHours={[0, 2, 21]} | ||
46 | disabledMinutes={[0, 2, 21]} | ||
47 | disabledSeconds={[]} | ||
48 | hideDisabledOptions={true} />, | ||
33 | document.getElementById('__react-content') | 49 | document.getElementById('__react-content') |
34 | ); | 50 | ); |