diff --git a/src/components/SimpleKeyboard.vue b/src/components/SimpleKeyboard.vue index a48bc84..a9ac0e1 100644 --- a/src/components/SimpleKeyboard.vue +++ b/src/components/SimpleKeyboard.vue @@ -129,15 +129,10 @@ export default { } } else if (button === '{clear}') { this.keyboard.clearInput() - } else { - // let value = $event.target.offsetParent.parentElement.children[0].children[0].value - // // 输入框有默认值时,覆写 - // if (value) { - // this.keyboard.setInput(value) - // } - this.$emit('onKeyPress', button) + } else if (button === '{shift}' || button === '{lock}') { + this.handleShift() } - if (button === '{shift}' || button === '{lock}') this.handleShift() + this.$emit('onKeyPress', button) }, // 切换shift/默认布局 handleShift () { diff --git a/src/components/keyboard-input.vue b/src/components/keyboard-input.vue index 21700e2..1626794 100644 --- a/src/components/keyboard-input.vue +++ b/src/components/keyboard-input.vue @@ -102,6 +102,17 @@ export default { }, 0) }, onKeyPress (button) { + if (button === '{lock}' || button === '{shift}' || button === '{change}' || button === '{bksp}' || button === '{clear}') { + this.$nextTick(() => { + this.inputEle.focus() + }) + setTimeout(() => { + this.inputEle.focus() + }, 0) + } + if (button === '{clear}') { + this.inputValue = '' + } console.log('onKeyPress', button) } } diff --git a/src/pages/modules/login/login.vue b/src/pages/modules/login/login.vue index eb21864..53c7157 100644 --- a/src/pages/modules/login/login.vue +++ b/src/pages/modules/login/login.vue @@ -13,11 +13,21 @@
- + +
- +
@@ -28,11 +38,15 @@
@@ -45,9 +59,13 @@