diff --git a/src/core/view/components/input/index.vue b/src/core/view/components/input/index.vue index 5a950e0495a9f34e3184a171bd7b84a6e486677b..500be7ad22fc27ff36916086675e03dc49277a6b 100644 --- a/src/core/view/components/input/index.vue +++ b/src/core/view/components/input/index.vue @@ -22,6 +22,7 @@ :type="inputType" :maxlength="maxlength" :step="step" + :autofocus="focus" class="uni-input-input" autocomplete="off" @focus="_onFocus" @@ -118,8 +119,8 @@ export default { } }, watch: { - focus (value) { - value && this._focusInput() + focus (val) { + this.$refs.input && this.$refs.input[val ? 'focus' : 'blur']() }, maxlength (value) { const realValue = this.valueSync.slice(0, parseInt(value, 10)) @@ -154,8 +155,6 @@ export default { } this.initKeyboard(this.$refs.input) - - this.focus && this._focusInput() }, beforeDestroy () { this.$dispatch('Form', 'uni-form-group-update', { @@ -212,16 +211,6 @@ export default { value: $event.target.value }) }, - _focusInput () { - setTimeout(() => { - this.$refs.input.focus() - }, 350) - }, - _blurInput () { - setTimeout(() => { - this.$refs.input.blur() - }, 350) - }, _onComposition ($event) { if ($event.type === 'compositionstart') { this.composing = true