1. 程式人生 > >vue關於微信開發,輸入法把底部頂上去的情況

vue關於微信開發,輸入法把底部頂上去的情況

    前置,document.body.clientHeight在標籤<!DOCTYPE>的頁面裡得到的結果是0,所以得用document.documentElement.clientHeigh。剛開始我也糾結了很久,為什麼無論怎麼變都是0,多次查詢後才瞭解到的。 

具體程式碼:

mounted:function() {

this.screenHeight1=document.documentElement.clientHeight

var that=this

window.onresize=()=>{

return(()=>{

that.screenHeight=document.documentElement.clientHeight

})()

}

},

watch:{

screenHeight:function(newval,oldval) {

if(newval

this.hidshow=false

}else{

this.hidshow=true

}

}

},

也就是說,在頁面可是區域變小的時候把底部給隱藏了。