提交 37e1e130 编写于 作者: Q qiang

fix: 修复 input 组件设置 focus 为 false 时无法失去焦点的问题

上级 65b2cc36
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
:type="inputType" :type="inputType"
:maxlength="maxlength" :maxlength="maxlength"
:step="step" :step="step"
:autofocus="focus"
class="uni-input-input" class="uni-input-input"
autocomplete="off" autocomplete="off"
@focus="_onFocus" @focus="_onFocus"
...@@ -118,8 +119,8 @@ export default { ...@@ -118,8 +119,8 @@ export default {
} }
}, },
watch: { watch: {
focus (value) { focus (val) {
value && this._focusInput() this.$refs.input && this.$refs.input[val ? 'focus' : 'blur']()
}, },
maxlength (value) { maxlength (value) {
const realValue = this.valueSync.slice(0, parseInt(value, 10)) const realValue = this.valueSync.slice(0, parseInt(value, 10))
...@@ -154,8 +155,6 @@ export default { ...@@ -154,8 +155,6 @@ export default {
} }
this.initKeyboard(this.$refs.input) this.initKeyboard(this.$refs.input)
this.focus && this._focusInput()
}, },
beforeDestroy () { beforeDestroy () {
this.$dispatch('Form', 'uni-form-group-update', { this.$dispatch('Form', 'uni-form-group-update', {
...@@ -212,16 +211,6 @@ export default { ...@@ -212,16 +211,6 @@ export default {
value: $event.target.value value: $event.target.value
}) })
}, },
_focusInput () {
setTimeout(() => {
this.$refs.input.focus()
}, 350)
},
_blurInput () {
setTimeout(() => {
this.$refs.input.blur()
}, 350)
},
_onComposition ($event) { _onComposition ($event) {
if ($event.type === 'compositionstart') { if ($event.type === 'compositionstart') {
this.composing = true this.composing = true
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册