分析:软键盘弹出后,导致页面高度变化

解决方案:软键盘弹出后,修复页面高度

// 监听窗口变化
    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)
            });
        }
    },

 

相关文章:

  • 2022-12-23
  • 2021-11-01
  • 2022-12-23
  • 2021-08-13
  • 2021-09-21
  • 2022-12-23
  • 2022-03-06
猜你喜欢
  • 2021-11-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-15
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案