From 83bc9d40c2b958dd826dd0353f7edf08bbc326f8 Mon Sep 17 00:00:00 2001 From: xsx <825657193@qq.com> Date: Wed, 19 Feb 2025 22:28:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BC=E5=AE=B9ios=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E9=94=AE=E7=9B=98=E9=AB=98=E5=BA=A6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- im-uniapp/pages/chat/chat-box.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/im-uniapp/pages/chat/chat-box.vue b/im-uniapp/pages/chat/chat-box.vue index 82c313c..65f1d6b 100644 --- a/im-uniapp/pages/chat/chat-box.vue +++ b/im-uniapp/pages/chat/chat-box.vue @@ -750,9 +750,12 @@ export default { // ios h5实现键盘监听 window.addEventListener('focusin', this.focusInListener); window.addEventListener('focusout', this.focusOutListener); + // 监听键盘高度,ios13以上开始支持 + if(window.visualViewport){ + window.visualViewport.addEventListener('resize', this.resizeListener); + } } else { // 安卓h5实现键盘监听 - let initHeight = window.innerHeight; window.addEventListener('resize', this.resizeListener); } // #endif @@ -763,7 +766,6 @@ export default { }, unListenKeyboard() { // #ifdef H5 - // 安卓h5实现键盘监听 window.removeEventListener('resize', this.resizeListener); window.removeEventListener('focusin', this.focusInListener); window.removeEventListener('focusout', this.focusOutListener);