问题:键盘弹起将底部按钮顶上去遮住输入框
解决思路:实时监听窗口高度与初始高度比较,判断键盘是否弹起,弹起隐藏底部否则显示底部
/vue/
<div class='footer' v-show="isShow"></div>
export default{
data(){
return{
originHeight: 0, // 原始高度
screenHeight: 0, // 实际高度
isShow: true, // 显示或隐藏底部信息
}
},
methods:{
watchResize() {
//实时变化的窗口高度
this.screenHeight = document.documentElement.clientHeight;
},
},
mounted () {
//首次进入的原始高度
this.originalHeight = document.documentElement.clientHeight;
//监听屏幕变化并获取到屏幕原始高度
window.addEventListener('resize', this.watchResize);
},
beforeDestroy() {
window.removeEventListener("resize", this.watchResize);
},
watch:{
screenHeight(newVal) {
this.isShow= this.originalHeight <= newVal;
}
},
}