Skip to content

Commit

Permalink
fix: time-picker focus blur autoFocus not work
Browse files Browse the repository at this point in the history
  • Loading branch information
tangjinzhou committed Jun 17, 2018
1 parent d6aeb97 commit 28d009d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions components/time-picker/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ export const TimePickerProps = () => ({
align: PropTypes.object,
placement: PropTypes.any,
transitionName: PropTypes.string,
autoFocus: PropTypes.bool,
addon: PropTypes.any,
})

export default {
Expand Down Expand Up @@ -146,6 +148,7 @@ export default {
class: className,
ref: 'timePicker',
on: {
...this.$listeners,
change: this.handleChange,
open: this.handleOpenClose,
close: this.handleOpenClose,
Expand Down
8 changes: 8 additions & 0 deletions components/vc-time-picker/TimePicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ function noop () {

export default {
mixins: [BaseMixin],
name: 'VcTimePicker',
props: initDefaultProps({
prefixCls: PropTypes.string,
clearText: PropTypes.string,
Expand Down Expand Up @@ -84,6 +85,13 @@ export default {
sValue: value,
}
},
mounted () {
this.$nextTick(() => {
if (this.autoFocus) {
this.focus()
}
})
},

watch: {
value (val) {
Expand Down

0 comments on commit 28d009d

Please sign in to comment.