//用于判断软键盘
docmHeight: document.documentElement.clientHeight ||document.body.clientHeight,
showHeight: document.documentElement.clientHeight ||document.body.clientHeight,
hideshow:false, //软键盘是否弹起,
<div :class="{'saveContent2':hideshow,'saveContent':!hideshow}" @click="nextClick">下一步</div>
watch: {
// 监听显示高度
showHeight:function() {
let that = this;
if(that.docmHeight > this.showHeight){
//弹起
that.hideshow=true;
}else{
//收起
that.hideshow=false;
}
window.addEventListener('resize', () => {
if (document.activeElement.tagName == 'INPUT') {
window.setTimeout(() => {
document.activeElement.scrollIntoViewIfNeeded();
}, 100);
}
})
}
},
mounted(){
let that = this;
window.onresize = ()=>{
return(()=>{
that.showHeight = document.documentElement.clientHeight || document.body.clientHeight;
})()
}