移动端google浏览器默认事件

xiaoxiao2021-02-28  81

从 chrome56 开始,在 window、document 和 body 上注册的 touchstart 和 touchmove 事件处理函数,会默认为是 passive: true。浏览器忽略 preventDefault()

举例: wnidow.addEventListener(‘touchmove’, func) 效果和下面一句一样 wnidow.addEventListener(‘touchmove’, func, { passive: true })

所以在谷歌浏览器处理默认事件时要使用: wnidow.addEventListener(‘touchmove’, func, { passive: true }) 才不会报如上图的警告。

转载请注明原文地址: https://www.6miu.com/read-85009.html

最新回复(0)