安卓H5 vue 输入框聚焦导致position: fixed 按钮上移动
mounted() { this.$nextTick(_ => { const realHeight = window.innerWidth > window.innerHeight ? window.innerWidth : window.innerHeight const originalHeight = document.documentElement.clientHeight ||document.body.clientHeight window.addEventListener('resize', () => { //键盘弹起与隐藏都会引起窗口的高度发生变化 const resizeHeight = document.documentElement.clientHeight || document.body.clientHeight if (resizeHeight - 0 < originalHeight - 0) { //当软键盘弹起,在此处操作 console.log('进入到软键盘弹起=========') this.showBtn = false } else { //当软键盘收起,在此处操作 console.log('进入到软键盘收起=========') this.showBtn = true } }) }) },
通过showBtn去设置按钮的隐藏显示,弹起时隐藏按钮,收起时显示

浙公网安备 33010602011771号