Browse Source

安卓输入框上弹1

dev
no99 6 days ago
parent
commit
d18b6c6294
  1. 48
      src/views/homePage.vue

48
src/views/homePage.vue

@ -1,6 +1,6 @@
<script setup>
//
import { ref, computed, onMounted, watch, nextTick, onUnmounted } from "vue";
import { ref, computed, onMounted, watch, nextTick, onUnmounted, h } from "vue";
import { setHeight } from "../utils/setHeight";
import { getUserCountAPI } from "../api/AIxiaocaishen";
import { ElMessage } from "element-plus";
@ -417,46 +417,32 @@ const goToRecharge = () => {
};
const adjustFooterPosition = (height) => {
console.log("调整底部位置", height);
const footer = document.querySelector(".el-footer");
const main = document.querySelector(".el-main");
const homePage = document.querySelector(".homepage");
const app = document.getElementById("app");
// Footer 60px // Footer
// footer.style.bottom = `${keyboardHeight}px`;
// Main Footer +
homePage.style.height = `${height}px`;
// app.style.height = `${height}px`;
void homePage.offsetHeight;
const html = document.querySelector("html");
const body = document.querySelector("body");
html.style.height = `${height}px`;
body.style.height = `${height}px`;
const isAndroid = /Android/i.test(navigator.userAgent);
if (isAndroid) {
console.log("是安卓设备");
console.log("window.visualViewport", window.visualViewport.height);
const homePage = document.querySelector(".homepage");
homePage.style.height = `${height}px`;
// homePage.style.height = `460px`;
html.scrollTop = 0;
html.scrollTop = 0;
} else {
console.log("非安卓设备");
console.log("调整底部位置", height);
const homePage = document.querySelector(".homepage");
homePage.style.height = `${height}px`;
html.scrollTop = 0;
}
setTimeout(() => {
//
html.style.overflow = "hidden";
body.style.overflow = "hidden";
}, 200);
// console.log(html.offsetHeight, 'html')
// console.log(html.clientHeight, 'html')
// console.log(html.scrollHeight, 'htmlScrollHeight')
// console.log(body.clientHeight, 'body')
// console.log(body.scrollHeight, 'bodyScrollHeight')
// console.log(homePage.offsetHeight, 'homePage')
// console.log(homePage.clientHeight, 'homePageClientHeight')
// console.log(homePage.scrollHeight, 'homePageScrollHeight')
// console.log(window.innerHeight, 'window.innerHeight')
// console.log(window.visualViewport.height, 'window.visualViewport.height')
// console.log(main.offsetHeight, 'main')
// console.log(main.clientHeight, 'mainClientHeight')
// console.log(main.scrollHeight, 'mainScrollHeight')
};
const onFocus = function () {

Loading…
Cancel
Save