hookehuyr

fix 动态计算弹出框高度

......@@ -18,7 +18,7 @@
:rules="rules"
:required="item.component_props.required"
readonly
@touchstart.stop="openKeyboard()"
@touchstart.stop="openKeyboard($event)"
:border="false"
>
</van-field>
......@@ -41,11 +41,17 @@ const props = defineProps({
const show = ref(false);
const openKeyboard = () => {
const openKeyboard = (e) => {
show.value = true;
// 键盘上移动
document.body.style.paddingBottom = "100px";
document.documentElement.scrollTop = 100;
const height =
window.innerHeight -
e.target.getBoundingClientRect().y -
e.target.getBoundingClientRect().height +
50;
document.body.style.paddingBottom = height + "px";
document.documentElement.scrollTop = height;
console.warn(height);
};
const blurKeyboard = () => {
show.value = false;
......