From 37e1e130dddc1990fe169225a3f4b525231ac663 Mon Sep 17 00:00:00 2001 From: qiang Date: Wed, 3 Jun 2020 18:51:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20input=20=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=AE=BE=E7=BD=AE=20focus=20=E4=B8=BA=20false=20?= =?UTF-8?q?=E6=97=B6=E6=97=A0=E6=B3=95=E5=A4=B1=E5=8E=BB=E7=84=A6=E7=82=B9?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/view/components/input/index.vue | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/core/view/components/input/index.vue b/src/core/view/components/input/index.vue index 5a950e04..500be7ad 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 -- GitLab