From 4fd1dc8ceae5b5a2cc316ce593708454cc00c766 Mon Sep 17 00:00:00 2001 From: qiang Date: Fri, 9 Jul 2021 17:49:32 +0800 Subject: [PATCH] =?UTF-8?q?fix(App):=20=E4=BF=AE=E5=A4=8D=20iOS=20?= =?UTF-8?q?=E7=AB=AF=20"softinputMode":=20"adjustResize"=20=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=A4=B1=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98=20questi?= =?UTF-8?q?on/126632?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/view/mixins/keyboard.js | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/core/view/mixins/keyboard.js b/src/core/view/mixins/keyboard.js index 2ee4d4f5d..e8cb6c54b 100644 --- a/src/core/view/mixins/keyboard.js +++ b/src/core/view/mixins/keyboard.js @@ -13,11 +13,6 @@ if (__PLATFORM__ === 'app-plus') { plusReady(() => { isAndroid = plus.os.name.toLowerCase() === 'android' osVersion = plus.os.version - // iOS 14.6 调用同步方法导致键盘弹卡顿 - if (!isAndroid && parseFloat(osVersion) >= 14.6) { - const currentWebview = plus.webview.currentWebview() - webviewStyle = currentWebview.getStyle() || {} - } }) document.addEventListener('keyboardchange', function (event) { keyboardHeight = event.height @@ -160,13 +155,22 @@ export default { } }) } - if (!isAndroid && parseInt(osVersion) < 12) { + if (!isAndroid) { // iOS12 以下系统 focus 事件设置较迟,改在 touchstart 设置 - el.addEventListener('touchstart', () => { - if (!this.disabled && !focus) { - setSoftinputTemporary(this) - } - }) + if (parseInt(osVersion) < 12) { + el.addEventListener('touchstart', () => { + if (!this.disabled && !focus) { + setSoftinputTemporary(this) + } + }) + } + // iOS 14.6 调用同步方法导致键盘弹卡顿 + if (parseFloat(osVersion) >= 14.6 && !webviewStyle) { + plusReady(() => { + const currentWebview = plus.webview.currentWebview() + webviewStyle = currentWebview.getStyle() || {} + }) + } } } -- GitLab