vue关于微信开发,输入法把底部顶上去的情况

    前置,document.body.clientHeight在标签<!DOCTYPE>的页面里得到的结果是0,所以得用document.documentElement.clientHeigh。刚开始我也纠结了很久,为什么无论怎么变都是0,多次查询后才了解到的。 

具体代码:

mounted:function() {

this.screenHeight1=document.documentElement.clientHeight

var that=this

window.οnresize=()=>{

return(()=>{

that.screenHeight=document.documentElement.clientHeight

})()

}

},

watch:{

screenHeight:function(newval,oldval) {

if(newval

this.hidshow=false

}else{

this.hidshow=true

}

}

},

也就是说,在页面可是区域变小的时候把底部给隐藏了。

猜你喜欢

转载自blog.csdn.net/theoneEmperor/article/details/77949883
今日推荐