From 28d009d3ced807051a86a2c09cd2764303de98f7 Mon Sep 17 00:00:00 2001 From: tjz <415800467@qq.com> Date: Sun, 17 Jun 2018 15:56:12 +0800 Subject: [PATCH] fix: time-picker focus blur autoFocus not work --- components/time-picker/index.jsx | 3 +++ components/vc-time-picker/TimePicker.jsx | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/components/time-picker/index.jsx b/components/time-picker/index.jsx index 83243768ea..199021943d 100644 --- a/components/time-picker/index.jsx +++ b/components/time-picker/index.jsx @@ -55,6 +55,8 @@ export const TimePickerProps = () => ({ align: PropTypes.object, placement: PropTypes.any, transitionName: PropTypes.string, + autoFocus: PropTypes.bool, + addon: PropTypes.any, }) export default { @@ -146,6 +148,7 @@ export default { class: className, ref: 'timePicker', on: { + ...this.$listeners, change: this.handleChange, open: this.handleOpenClose, close: this.handleOpenClose, diff --git a/components/vc-time-picker/TimePicker.jsx b/components/vc-time-picker/TimePicker.jsx index 3118c8378a..f1380bccca 100644 --- a/components/vc-time-picker/TimePicker.jsx +++ b/components/vc-time-picker/TimePicker.jsx @@ -12,6 +12,7 @@ function noop () { export default { mixins: [BaseMixin], + name: 'VcTimePicker', props: initDefaultProps({ prefixCls: PropTypes.string, clearText: PropTypes.string, @@ -84,6 +85,13 @@ export default { sValue: value, } }, + mounted () { + this.$nextTick(() => { + if (this.autoFocus) { + this.focus() + } + }) + }, watch: { value (val) {