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

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

上级 65b2cc36
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册