当做h5页面时 相信大家和我一样 最烦的就是处理各种兼容和适配了 下面介绍的是解决android手机软键盘弹出顶起影响了页面布局 废话不多说 先上图吧 ps(手机直接截图 分辨率比较大 大家凑合看下)
代码如下
<div @click="nextstep" class="loneNext" v-show="hidshow">下一步</div>
data(){
return{
docmHeight: document.documentElement.clientHeight, //此处也可能是其他获取方法
showHeight: document.documentElement.clientHeight,
hidshow:true
}
},
watch:{
showHeight() {
if(this.docmHeight > this.showHeight){
this.hidshow=false
}else{
this.hidshow=true
}
}
},
mounted(){
window.onresize = ()=>{
return(()=>{
this.showHeight = document.body.clientHeight;
})()
}
}
完美解决了