diff --git a/src/pages/courseDetail/components/comment.vue b/src/pages/courseDetail/components/comment.vue index b99ce974..dde2ad79 100644 --- a/src/pages/courseDetail/components/comment.vue +++ b/src/pages/courseDetail/components/comment.vue @@ -134,9 +134,17 @@ reply_data.parentBbsId = parentBbsId reply_data.bbsId = item.bbsId reply_data.index = index + const systemInfo = uni.getSystemInfoSync(); + // 安全区域底部到屏幕底部的高度(即底部安全区域高度) + const safeAreaBottomHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom; nextTick(() => { uni.onKeyboardHeightChange(res => { - popup_input_bottom.value = `${res.height}px`; + let keyboardHeight = res.height; + // 仅在iOS端补偿安全区域高度 + if (systemInfo.platform === 'ios') { + keyboardHeight = Math.max(0, keyboardHeight - safeAreaBottomHeight); // 避免负数 + } + popup_input_bottom.value = `${keyboardHeight}px`; console.log(res); }); }) @@ -230,7 +238,7 @@