vue监听滑动事件,隐藏移动端键盘或者input失去焦点
时间:2018-04-28 14:18:06
收藏:0
阅读:3917
在页面加载的地方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(); // 关闭键盘 } },
评论(0)