|
|
@ -536,32 +536,6 @@ onMounted(async () => { |
|
|
|
// 监听页面高度 |
|
|
|
throttledHeightListener(); |
|
|
|
|
|
|
|
const isAndroid = /Android/i.test(navigator.userAgent); |
|
|
|
if (isAndroid) { |
|
|
|
window.visualViewport.addEventListener("resize", () => { |
|
|
|
const keyboardHeight = window.innerHeight - window.visualViewport.height; |
|
|
|
console.log("视口大小变化", keyboardHeight); |
|
|
|
|
|
|
|
// 如果键盘高度大于100px,认为键盘弹出 |
|
|
|
if (keyboardHeight > 100) { |
|
|
|
const footer = document.querySelector(".el-footer"); |
|
|
|
footer.style.paddingBottom = `${keyboardHeight}px`; |
|
|
|
|
|
|
|
// 滚动到输入框位置 |
|
|
|
setTimeout(() => { |
|
|
|
const msgInput = document.querySelector(".msg-input"); |
|
|
|
if (msgInput) { |
|
|
|
msgInput.scrollIntoView({ behavior: "smooth" }); |
|
|
|
} |
|
|
|
}, 300); |
|
|
|
} else { |
|
|
|
// 键盘收起 |
|
|
|
const footer = document.querySelector(".el-footer"); |
|
|
|
footer.style.paddingBottom = "0px"; |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
// 添加输入框焦点处理 |
|
|
|
// handleInputFocus(); |
|
|
|
|
|
|
|