移动端 提交按钮呗软键盘挤上去的问题解决

 data() {
    return {
      docmHeight: document.documentElement.clientHeight,
      showHeight: document.documentElement.clientHeight,
      hideClass: false,
    }
  },
 
methods{
// 检测屏幕高度变化
    inputType() {
      if (!this.timer) {
        this.timer = true
        const that = this
        setTimeout(() => {
          if (that.docmHeight > that.showHeight) {
          // 显示class
            this.hideClass = true
          } else if (that.docmHeight <= that.showHeight) {
            // 显示隐藏
            this.hideClass = false
          }
          that.timer = false
        }, 20)
      }
    },
}
 mounted() {
    // window.onresize监听页面高度的变化
    window.onresize = () => (() => {
      window.screenHeight = document.body.clientHeight
      this.showHeight = window.screenHeight
    })()
  },
原文地址:https://www.cnblogs.com/wsj1/p/14148812.html