// 阻止滚动
const stopScrolling = e => {
e.preventDefault();
};
// 取消阻止
const unblockStopScrolling = e => {
e.stopPropagation();
};
useEffect(() => {
if (refContext.current) {
refContext.current.addEventListener('touchmove', unblockStopScrolling, { passive: true });
document.addEventListener('touchmove', stopScrolling, { passive: false });
}
if (!isFullScreenPopUp) {
document.removeEventListener('touchmove', stopScrolling, false);
document.removeEventListener('touchmove', unblockStopScrolling, false);
}
return () => {
document.removeEventListener('touchmove', stopScrolling, false);
document.removeEventListener('touchmove', unblockStopScrolling, false);
};
}, [isFullScreenPopUp]);
h5在ios弹窗滚动穿透滚动问题,最快解决方式
最新推荐文章于 2024-06-21 16:57:04 发布