在页面加载的地方mounted或者created写监听事件,注意使用touchmove事件

window.addEventListener("touchmove",this.myTouchMove)  // 监听滑动事件
// 滑动关闭键盘
      myTouchMove: function (evt) {
        if(document.hasFocus){
          const inputId = document.getElementById('myBox')  // 获取ID
          inputId.blur()  // input失焦
          // document.activeElement.blur();   //  关闭键盘
        }
      },

  

posted on 2018-04-28 11:29  懒人猫  阅读(2123)  评论(1编辑  收藏  举报