Skip to content

Commit d0d5552

Browse files
committed
fix: time-picker focus blur autoFocus not work
1 parent 92c8a05 commit d0d5552

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

components/time-picker/index.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ export const TimePickerProps = () => ({
5555
align: PropTypes.object,
5656
placement: PropTypes.any,
5757
transitionName: PropTypes.string,
58+
autoFocus: PropTypes.bool,
59+
addon: PropTypes.any,
5860
})
5961

6062
export default {
@@ -146,6 +148,7 @@ export default {
146148
class: className,
147149
ref: 'timePicker',
148150
on: {
151+
...this.$listeners,
149152
change: this.handleChange,
150153
open: this.handleOpenClose,
151154
close: this.handleOpenClose,

components/vc-time-picker/TimePicker.jsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ function noop () {
1212

1313
export default {
1414
mixins: [BaseMixin],
15+
name: 'VcTimePicker',
1516
props: initDefaultProps({
1617
prefixCls: PropTypes.string,
1718
clearText: PropTypes.string,
@@ -84,6 +85,13 @@ export default {
8485
sValue: value,
8586
}
8687
},
88+
mounted () {
89+
this.$nextTick(() => {
90+
if (this.autoFocus) {
91+
this.focus()
92+
}
93+
})
94+
},
8795

8896
watch: {
8997
value (val) {

0 commit comments

Comments
 (0)