苹果键盘适配

This commit is contained in:
2025-07-24 16:46:55 +08:00
parent 91bf4fa4ad
commit 383acaf922
+10 -2
View File
@@ -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 @@
<style lang="scss" scoped>
.popup {
z-index: 1200;
z-index: 18000;
}
.empty_message_div {