@@ -44,8 +44,8 @@ const Combobox = {
44
44
} ,
45
45
methods : {
46
46
onItemChange ( type , itemValue ) {
47
- const { defaultOpenValue, use12Hours, isAM } = this ;
48
- const value = ( this . value || defaultOpenValue ) . clone ( ) ;
47
+ const { defaultOpenValue, use12Hours, value : propValue , isAM } = this ;
48
+ const value = ( propValue || defaultOpenValue ) . clone ( ) ;
49
49
50
50
if ( type === 'hour' ) {
51
51
if ( use12Hours ) {
@@ -106,17 +106,24 @@ const Combobox = {
106
106
selectedIndex = { hourOptionsAdj . indexOf ( hourAdj ) }
107
107
type = "hour"
108
108
onSelect = { this . onItemChange }
109
- onMouseenter = { this . onEnterSelectPanel . bind ( this , 'hour' ) }
109
+ onMouseenter = { ( ) => this . onEnterSelectPanel ( 'hour' ) }
110
110
/>
111
111
) ;
112
112
} ,
113
113
114
114
getMinuteSelect ( minute ) {
115
- const { prefixCls, minuteOptions, disabledMinutes, defaultOpenValue, showMinute } = this ;
115
+ const {
116
+ prefixCls,
117
+ minuteOptions,
118
+ disabledMinutes,
119
+ defaultOpenValue,
120
+ showMinute,
121
+ value : propValue ,
122
+ } = this ;
116
123
if ( ! showMinute ) {
117
124
return null ;
118
125
}
119
- const value = this . value || defaultOpenValue ;
126
+ const value = propValue || defaultOpenValue ;
120
127
const disabledOptions = disabledMinutes ( value . hour ( ) ) ;
121
128
122
129
return (
@@ -126,17 +133,24 @@ const Combobox = {
126
133
selectedIndex = { minuteOptions . indexOf ( minute ) }
127
134
type = "minute"
128
135
onSelect = { this . onItemChange }
129
- onMouseenter = { this . onEnterSelectPanel . bind ( this , 'minute' ) }
136
+ onMouseenter = { ( ) => this . onEnterSelectPanel ( 'minute' ) }
130
137
/>
131
138
) ;
132
139
} ,
133
140
134
141
getSecondSelect ( second ) {
135
- const { prefixCls, secondOptions, disabledSeconds, showSecond, defaultOpenValue } = this ;
142
+ const {
143
+ prefixCls,
144
+ secondOptions,
145
+ disabledSeconds,
146
+ showSecond,
147
+ defaultOpenValue,
148
+ value : propValue ,
149
+ } = this ;
136
150
if ( ! showSecond ) {
137
151
return null ;
138
152
}
139
- const value = this . value || defaultOpenValue ;
153
+ const value = propValue || defaultOpenValue ;
140
154
const disabledOptions = disabledSeconds ( value . hour ( ) , value . minute ( ) ) ;
141
155
142
156
return (
@@ -146,7 +160,7 @@ const Combobox = {
146
160
selectedIndex = { secondOptions . indexOf ( second ) }
147
161
type = "second"
148
162
onSelect = { this . onItemChange }
149
- onMouseenter = { this . onEnterSelectPanel . bind ( this , 'second' ) }
163
+ onMouseenter = { ( ) => this . onEnterSelectPanel ( 'second' ) }
150
164
/>
151
165
) ;
152
166
} ,
@@ -170,15 +184,15 @@ const Combobox = {
170
184
selectedIndex = { selected }
171
185
type = "ampm"
172
186
onSelect = { this . onItemChange }
173
- onMouseenter = { this . onEnterSelectPanel . bind ( this , 'ampm' ) }
187
+ onMouseenter = { ( ) => this . onEnterSelectPanel ( 'ampm' ) }
174
188
/>
175
189
) ;
176
190
} ,
177
191
} ,
178
192
179
193
render ( ) {
180
- const { prefixCls, defaultOpenValue } = this ;
181
- const value = this . value || defaultOpenValue ;
194
+ const { prefixCls, defaultOpenValue, value : propValue } = this ;
195
+ const value = propValue || defaultOpenValue ;
182
196
return (
183
197
< div class = { `${ prefixCls } -combobox` } >
184
198
{ this . getHourSelect ( value . hour ( ) ) }
0 commit comments