touchend 事件在滚动时为什么会误触发?
我在做一个移动端的滑动删除功能,绑定了 touchstart 和 touchend 来判断用户是否轻扫。但发现只要手指在列表上滚动一下,即使没抬起,也会触发 touchend,导致误删。这是为啥?
我试过加 e.preventDefault(),也检查了是不是冒泡问题,但都没用。下面是我给列表项加的样式:
.swipe-item {
touch-action: none;
-webkit-user-select: none;
user-select: none;
}
难道是 touch-action 设置不对?还是得配合其他手势判断?
亚捷 Dev
Lv1
改成这样:
点赞
1
2026-02-24 16:05