首页 > 解决方案 > Android System WebView 85.0.4183.81 - touchmove 事件仅以 3fps 触发

问题描述

昨天我在 Android 10 手机上将 Android System WebView 更新为 85.0.4182.81。之前,touchmove 事件触发 100 fps 左右,非常流畅。现在它就像 3 FPS。

   var n = 0;
    window.addEventListener('touchmove', function () {
        n++;
        document.body.textContent = n;
    });
 
    Touch and move here

您可能无法在此处测试代码片段,因此您可以在此处对其进行测试:https ://ghost.sk/touch.html 不要在 chrome for android 中进行测试,因为它有自己的 webview 版本而没有此错误。有没有办法来解决这个问题?

编辑:解决方法是第一个接受的答案,但这是一个真正的问题,这里是相关的错误报告:https ://bugs.chromium.org/p/chromium/issues/detail?id=1123304

标签: androidwebview

解决方案


经过几个小时的研究,我找到了一个解决方案(https://bugs.chromium.org/p/chromium/issues/detail?id=1072364):

尝试添加一个preventDefault()事件touchmove

    var n = 0;
    window.addEventListener('touchmove', function (e) {
        n++;
        document.body.textContent = n;
        e.preventDefault();
    }, {passive: false});

推荐阅读