分析:軟鍵盤彈出后,導致頁面高度變化
解決方案:軟鍵盤彈出后,修復頁面高度
// 監聽窗口變化 resizeScreen(){ if (!this.state.isIOS && this.state.isInApp) { var originHeight = document.documentElement.clientHeight || document.body.clientHeight; this.$nextTick(()=>{ let bodyE = document.querySelector('.pop-other'); window.addEventListener('resize', function() { var resizeHeight = document.documentElement.clientHeight || document.body.clientHeight; if (originHeight < resizeHeight) { console.log('Android 鍵盤收起啦!'); // Android 鍵盤收起后操作 bodyE.style.height = 100+'%'; } else { console.log('Android 鍵盤彈起啦!'); // Android 鍵盤彈起后操作 bodyE.style.height = originHeight+'px'; } originHeight = resizeHeight; }, false) }); } },