zoukankan      html  css  js  c++  java
  • 移动端 监听键盘打开&收起

    Android

    mounted() {    
      window.onresize = () => {
        if (this.domHeight > document.documentElement.clientHeight) {
        // 获取焦点
    this.focus = true; } else {
        // 失去焦点
    this.focus = false; } }; }

    ios

    window.addEventListener("focusin", () => {
       // 获取焦点
       this.focus = true;
    });
    window.addEventListener("focusout", () => {
       // 失去焦点
       this.focus = false;
    });

    isIOS() {
       return /(iPhone|iPad|iPod|iOS)/gi.test(navigator.userAgent)
    },
    isAndroid() {
       return /(Android)/i.test(navigator.userAgent)
    },
  • 相关阅读:
    20210123
    20210122
    20210121
    20210120
    2020119
    20210118
    20210117
    20210116
    例2-8
    例2-6
  • 原文地址:https://www.cnblogs.com/jia-ze/p/13044687.html
Copyright © 2011-2022 走看看