当前位置: 移动技术网 > 科技>操作系统>windows > **如何解决ios点击输入框后键盘弹起,键盘收起后,输入框不恢复原位置,页面不能回弹导致下方有空白,弹框的确定按钮不能点击**

**如何解决ios点击输入框后键盘弹起,键盘收起后,输入框不恢复原位置,页面不能回弹导致下方有空白,弹框的确定按钮不能点击**

2020年10月29日  | 移动技术网科技  | 我要评论
1.给input框添加blur事件<input type=“text” placeholder=“手机验证码” maxlength=“4” v-model=“validationCode” @blur=“inputBlur”>2.在input框失焦后,先判断当前设备的系统是安卓还是iosinputBlur(){var ua = window.navigator.userAgent.toLowerCase();if(ua.indexOf(‘android’) > 0) {do

1.给input框添加blur事件
<input type=“text” placeholder=“手机验证码” maxlength=“4” v-model=“validationCode” @blur=“inputBlur”>
2.在input框失焦后,先判断当前设备的系统是安卓还是ios
inputBlur(){
var ua = window.navigator.userAgent.toLowerCase();
if(ua.indexOf(‘android’) > 0) {
document.querySelector(’#homeContainer’).style.height = ‘100vh’;
}else{
setTimeout(() => {
let scrollHeight = document.documentElement.scrollTop || document.body.scrollTop || 0;
window.scrollTo(0, Math.max(scrollHeight - 1, 0));
}, 100)
}
},

本文地址:https://blog.csdn.net/weixin_45373521/article/details/109360872

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网