Chrome和Safari浏览器preventDefault报treated as passive错误
Chrome和Safari浏览器preventDefault报treated as passive错误
问题代码是:
document.addEventListener('touchmove', function (event) { event.preventDefault(); });
修复后的JavaScript代码是:
document.addEventListener('touchmove', function (event) { event.preventDefault(); }, { passive: false });
检索代码中
addEventListener
关键字,false改为{passive: false}