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