vue监听滑动事件,隐藏移动端键盘或者input失去焦点

在页面加载的地方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();   //  关闭键盘
        }
      },

  

文章来自:https://www.cnblogs.com/summerXll/p/8966634.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3