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 - window.innerHeight - 48 + let scroll_height = "";
49 - e.target.getBoundingClientRect().y - 49 + if (target_to_view_height < 244) {
50 - e.target.getBoundingClientRect().height + 50 + scroll_height =
51 - 50; 51 + window.innerHeight -
52 - document.body.style.paddingBottom = height + "px"; 52 + e.target.getBoundingClientRect().y -
53 - document.documentElement.scrollTop = height; 53 + e.target.getBoundingClientRect().height +
54 + 244;
55 + document.body.style.paddingBottom = scroll_height + "px";
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 - window.innerHeight - 60 + let scroll_height = "";
61 - e.target.getBoundingClientRect().y + 61 + if (target_to_view_height < 244) {
62 - e.target.getBoundingClientRect().height + 62 + scroll_height =
63 - 244; 63 + window.innerHeight -
64 - document.body.style.paddingBottom = height + "px"; 64 + e.target.getBoundingClientRect().y -
65 - document.documentElement.scrollTop = height; 65 + e.target.getBoundingClientRect().height +
66 + 244;
67 + document.body.style.paddingBottom = scroll_height + "px";
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") {
......