diff options
Diffstat (limited to 'src/module/Combobox.jsx')
-rw-r--r-- | src/module/Combobox.jsx | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/module/Combobox.jsx b/src/module/Combobox.jsx index e6fe5ed..afce675 100644 --- a/src/module/Combobox.jsx +++ b/src/module/Combobox.jsx | |||
@@ -23,13 +23,13 @@ const Combobox = React.createClass({ | |||
23 | 23 | ||
24 | onItemChange(type, itemValue) { | 24 | onItemChange(type, itemValue) { |
25 | const { value, onChange } = this.props; | 25 | const { value, onChange } = this.props; |
26 | let index = 4; | 26 | if (type === 'hour') { |
27 | if (type === 'minute') { | 27 | value.setHourOfDay(itemValue); |
28 | index = 5; | 28 | } else if (type === 'minute') { |
29 | } else if (type === 'second') { | 29 | value.setMinutes(itemValue); |
30 | index = 6; | 30 | } else { |
31 | value.setSeconds(itemValue); | ||
31 | } | 32 | } |
32 | value.fields[index] = itemValue; | ||
33 | onChange(value); | 33 | onChange(value); |
34 | }, | 34 | }, |
35 | 35 | ||
@@ -80,13 +80,12 @@ const Combobox = React.createClass({ | |||
80 | 80 | ||
81 | render() { | 81 | render() { |
82 | const { prefixCls, value } = this.props; | 82 | const { prefixCls, value } = this.props; |
83 | const timeFields = value.fields; | ||
84 | 83 | ||
85 | return ( | 84 | return ( |
86 | <div className={`${prefixCls}-combobox`}> | 85 | <div className={`${prefixCls}-combobox`}> |
87 | {this.getHourSelect(timeFields[4])} | 86 | {this.getHourSelect(value.getHourOfDay())} |
88 | {this.getMinuteSelect(timeFields[5])} | 87 | {this.getMinuteSelect(value.getMinutes())} |
89 | {this.getSectionSelect(timeFields[6])} | 88 | {this.getSectionSelect(value.getSeconds())} |
90 | </div> | 89 | </div> |
91 | ); | 90 | ); |
92 | }, | 91 | }, |