瀏覽代碼

!132 兼容ios设备键盘高度问题
Merge pull request !132 from blue/v_3.0.0

blue 1 年之前
父節點
當前提交
c78f774872
共有 2 個文件被更改,包括 5 次插入3 次删除
  1. 4 2
      im-uniapp/pages/chat/chat-box.vue
  2. 1 1
      im-web/src/components/common/RightMenu.vue

+ 4 - 2
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);

+ 1 - 1
im-web/src/components/common/RightMenu.vue

@@ -1,5 +1,5 @@
 <template>
-	<div class="right-menu-mask" @click="close()" @contextmenu.prevent="close()">
+	<div class="right-menu-mask" @click.stop="close()" @contextmenu.prevent="close()">
 		<div class="right-menu" :style="{ 'left': pos.x + 'px', 'top': pos.y + 'px' }">
 			<el-menu text-color="#333333">
 				<el-menu-item v-for="(item) in items" :key="item.key" :title="item.name"