为什么 touchmove 事件在移动端会触发多次甚至卡顿?
我在做一个滑动删除功能,监听了 touchstart 和 touchmove,但发现手指稍微一动就触发好多次 touchmove,而且页面还会卡一下。是不是我哪里写错了?
我试过用 e.preventDefault() 但好像没用,代码大概是这样:
element.addEventListener('touchmove', (e) => {
const touch = e.touches[0];
console.log('移动位置:', touch.clientX, touch.clientY);
// 这里做了一些 DOM 操作
});
暂无解答