每当在手机上输入信息的时候,最下面的footer会被顶上来,特烦,所以解决这个问题就是获取到名目的高度和页面高度,当输入信息的时候就将底部的footer隐藏起来,这样就ok了
第一步:data () {
return {
docmHeight: document.documentElement.clientHeight, //默认屏幕高度
showHeight: document.documentElement.clientHeight, //实时屏幕高度
btnshow:true //显示或者隐藏footer
};
},
第二步:将onresiz挂载到mounted上
mounted() {
// window.onresize监听页面高度的变化
window.onresize = ()=>{
return(()=>{
this.showHeight = document.body.clientHeight;
})()
}
},
第三步:watch监控比较,判断按钮是否该显示出来
showHeight:function() {
if(this.docmHeight > this.showHeight){
this.btnshow=false
}else{
this.btnshow=true
}
}
第四步:在模板中给footer添加v-show
注册