fix: time-picker focus blur autoFocus not work

pull/77/merge
tjz 2018-06-17 15:56:12 +08:00
parent d6aeb976b1
commit 28d009d3ce
2 changed files with 11 additions and 0 deletions

View File

@ -55,6 +55,8 @@ export const TimePickerProps = () => ({
align: PropTypes.object, align: PropTypes.object,
placement: PropTypes.any, placement: PropTypes.any,
transitionName: PropTypes.string, transitionName: PropTypes.string,
autoFocus: PropTypes.bool,
addon: PropTypes.any,
}) })
export default { export default {
@ -146,6 +148,7 @@ export default {
class: className, class: className,
ref: 'timePicker', ref: 'timePicker',
on: { on: {
...this.$listeners,
change: this.handleChange, change: this.handleChange,
open: this.handleOpenClose, open: this.handleOpenClose,
close: this.handleOpenClose, close: this.handleOpenClose,

View File

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