From 172880aad3a8bbd4358cebfa4b6194a6244d0bd4 Mon Sep 17 00:00:00 2001 From: qiang Date: Fri, 15 Apr 2022 17:41:24 +0800 Subject: [PATCH] =?UTF-8?q?fix(h5):=20=E4=BF=AE=E5=A4=8D=E5=B0=8F=E7=B1=B3?= =?UTF-8?q?=E6=89=8B=E6=9C=BA=E9=83=A8=E5=88=86=E5=BA=94=E7=94=A8=EF=BC=88?= =?UTF-8?q?=E5=A6=82=E9=92=89=E9=92=89=EF=BC=89=E5=AF=86=E7=A0=81=E9=94=AE?= =?UTF-8?q?=E7=9B=98=E6=97=A0=E6=B3=95=E6=98=BE=E7=A4=BA=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/view/mixins/keyboard.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/core/view/mixins/keyboard.js b/src/core/view/mixins/keyboard.js index e8cb6c54b..61eb01bdd 100644 --- a/src/core/view/mixins/keyboard.js +++ b/src/core/view/mixins/keyboard.js @@ -102,6 +102,11 @@ export default { default: false } }, + computed: { + isApple () { + return String(navigator.vendor).indexOf('Apple') === 0 + } + }, directives: { keyboard: { inserted (el, binding, vnode) { @@ -195,7 +200,7 @@ export default { } // 修复ios端显示与点击位置错位的Bug by:wyq - if (String(navigator.vendor).indexOf('Apple') === 0) { + if (this.isApple) { document.documentElement.scrollTo(document.documentElement.scrollLeft, document.documentElement.scrollTop) } } @@ -203,7 +208,9 @@ export default { el.addEventListener('blur', () => { // 在iOS设备上,手动调用uni.hideKeyboard(),键盘收起并且触发blur,但实际并没有blur。 // 此时如果再点击页面其他地方会重新聚焦,此处做处理 - el.blur() + if (this.isApple) { + el.blur() + } focus = false onKeyboardHide() }) -- GitLab