h5 键盘弹起问题

110 阅读1分钟
 <div v-show="!isShowKeyBoard" class="bottom">
        <div class="text_con">
          <img class="icon" src="@/assets/imgs/guide/time_icon.png" />
          <span class="text">查看意见与反馈记录</span>
        </div>
        <div class="bottom_btn" @click="sure">提交</div>
      </div>
// 键盘弹起
const onKeyBoardUp = () => {
  isShowKeyBoard.value = true
}

// 键盘收起
const onKeyBoardDown = () => {
  isShowKeyBoard.value = false
}
onMounted(() => {
  let originalHeight = document.documentElement.clientHeight || document.body.clientHeight;
  window.onresize = function () {
    let resizeHeight = document.documentElement.clientHeight || document.body.clientHeight;
    if (resizeHeight - 0 < originalHeight - 0) {
      onKeyBoardUp()
    } else {
      onKeyBoardDown()
    }
  }
})