当h5内嵌到原生端后软键盘遮挡住输入框
data () {
return{
defaultHeight: document.documentElement.clientHeight,
nowHeight: document.documentElement.clientHeight,
}
}
mounted () {
window.onresize = () => {
return (() => {
this.nowHeight = document.documentElement.clientHeight
})();
};
},
watch: {
nowHeight() {
if(this.defaultHeight!= this.nowHeight){
let keyboard = document.getElementById('keyboard');
keyboard.style = this.defaultHeight-this.nowHeight + "px"
}else{
let keyboard = document.getElementById('keyboard');
keyboard.style = 'bottom:0px;'
}
}
}