hookehuyr

fix 弹出框键盘高度调整

...@@ -44,13 +44,17 @@ const show = ref(false); ...@@ -44,13 +44,17 @@ const show = ref(false);
44 const openKeyboard = (e) => { 44 const openKeyboard = (e) => {
45 show.value = true; 45 show.value = true;
46 // 键盘上移动 46 // 键盘上移动
47 - const height = 47 + const target_to_view_height = window.innerHeight - e.target.getBoundingClientRect().y; // 元素到适口高度
48 + let scroll_height = "";
49 + if (target_to_view_height < 244) {
50 + scroll_height =
48 window.innerHeight - 51 window.innerHeight -
49 e.target.getBoundingClientRect().y - 52 e.target.getBoundingClientRect().y -
50 e.target.getBoundingClientRect().height + 53 e.target.getBoundingClientRect().height +
51 - 50; 54 + 244;
52 - document.body.style.paddingBottom = height + "px"; 55 + document.body.style.paddingBottom = scroll_height + "px";
53 - document.documentElement.scrollTop = height; 56 + document.documentElement.scrollTop = scroll_height;
57 + }
54 }; 58 };
55 const blurKeyboard = () => { 59 const blurKeyboard = () => {
56 show.value = false; 60 show.value = false;
......
...@@ -56,13 +56,17 @@ const showKeyboard = (e) => { ...@@ -56,13 +56,17 @@ const showKeyboard = (e) => {
56 showInteger.value = true; 56 showInteger.value = true;
57 } 57 }
58 // 键盘上移动 58 // 键盘上移动
59 - const height = 59 + const target_to_view_height = window.innerHeight - e.target.getBoundingClientRect().y; // 元素到适口高度
60 + let scroll_height = "";
61 + if (target_to_view_height < 244) {
62 + scroll_height =
60 window.innerHeight - 63 window.innerHeight -
61 - e.target.getBoundingClientRect().y + 64 + e.target.getBoundingClientRect().y -
62 e.target.getBoundingClientRect().height + 65 e.target.getBoundingClientRect().height +
63 244; 66 244;
64 - document.body.style.paddingBottom = height + "px"; 67 + document.body.style.paddingBottom = scroll_height + "px";
65 - document.documentElement.scrollTop = height; 68 + document.documentElement.scrollTop = scroll_height;
69 + }
66 }; 70 };
67 const blurKeyboard = () => { 71 const blurKeyboard = () => {
68 if (props.item.component_props.type === "decimal") { 72 if (props.item.component_props.type === "decimal") {
......