移动端项目中,在滚动的时候,会报出以下提示:

[Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive.
See https://www.chromestatus.com/features/5093566007214080

解决

  1. touch的事件监听方法上绑定第三个参数{ passive: false }

    通过传递 passive 为 false 来明确告诉浏览器:事件处理程序调用 preventDefault 来阻止默认滑动行为。
target.addEventListener('touch', function () {

}, { passive: false });
  1. 在 CSS 中全局使用:
* {
touch-action: pan-y;
}

touch-action 的使用方法见:https://developer.mozilla.org/zh-CN/docs/Web/CSS/touch-action

参考:

https://juejin.im/post/5ad804c1f265da504547fe68

https://www.jianshu.com/p/04bf173826aa

移动端页面滑动时候警告:Unable to preventDefault inside passive event listener due to target being treated as passive.的更多相关文章

  1. [Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive.

    1.滑动时候警告[Intervention] Unable to preventDefault inside passive event listener due to target being tr ...

  2. Unable to preventDefault inside passive event listener due to target being treated as passive

    Unable to preventDefault inside passive event listener due to target being treated as passive 今天在做项目 ...

  3. IScroll Unable to preventDefault inside passive event listener due to target being treated as passive

    最近两天企业微信下IScroll突然无法滚动了,特别慢,之前好好的,发现主要是有红色的Unable to preventDefault inside passive event listener du ...

  4. [Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive. See https://www.chromestatus.com/features/5093566007214080

    相信如果用谷歌浏览器做移动端页面的时候 用touch事件的时候应该遇到过这个东东吧 documet.addEventListener("touchstart",function() ...

  5. 滑动报 Unable to preventDefault inside passive event listener due to target being treated as passive 的解决方法

    google浏览器滑动出现以下问题: 解决办法如下:在html元素下添加样式 touch-action: none; html{ touch-action:none; }

  6. Vue移动端报错[Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive.

    解决方法如下 项目方案: 在最外侧添加样式操作 .

  7. Unable to preventDefault inside passive event listener due to target being treated as passive?

    使用滚动时候,新版google浏览器,会弹出如下的警告. 解决方法,可以加上* { touch-action: none; } 这句样式去掉. 其原因:https://developers.googl ...

  8. 关于Google浏览器Unable to preventDefault inside passive event listener due to target being treated as passive.的解决方案

    最近写react项目的时候,引用了antd-mobile,在使用滚动组件的时候,发现谷歌浏览器会报以下警告 最初我以为是antd-mobile的问题导致的,然后我就无查看了之前的vue的项目,发现了类 ...

  9. Unable to preventDefault inside passive event listener due to target being treated as passive 怎么办?

    本篇为转载,原文链接:https://blog.csdn.net/lijingshan34/article/details/88350456 翻译一下:chrome 监听touch类事件报错:无法被动 ...

随机推荐

  1. 用例设计之API用例覆盖准则

    基本原则 本文主要讨论API测试的用例/场景覆盖,基本原则如下: 用户场景闭环(从哪来到哪去) 遍历所有的实现逻辑路径 需求点覆盖 覆盖维度 API协议(参数&业务场景) 中间件检查 异常场景 ...

  2. SQL Server全文搜索(转载)

    看这篇文章之前请先看一下下面我摘抄的全文搜索的MSDN资料,基本上MSDN上关于全文搜索的资料的我都copy下来了并且非常认真地阅读和试验了一次,并且补充了一些SQL语句,这篇文章本人抽取了一些本人自 ...

  3. mysql主从不同步问题 Error_code: 1236

    第一种情况,开启GTID,从库与主库不同步. 1.在从库上查看从的状态   mysql> show slave status \G *************************** 1. ...

  4. linux下取IP(正则)

    linux下取IP(正则) 常见方法: ifconfig eth0|grep "inet addr"|awk -F ":" '{print $2}'|awk ' ...

  5. plupload 大文件分片上传与PHP分片合并探索

    最近老大分给我了做一个电影cms系统,其中涉及到一个功能,使用七牛云的文件上传功能.七牛javascript skd,使用起来很方便,屏蔽了许多的技术细节.如果只满足与调用sdk,那么可能工作中也就没 ...

  6. django中url 和 path 的区别

    django中 url 和 path 都是配置路径,有什么不同? django.urls path django.conf.urls  url path 与 url 是两个不同的模块,效果都是响应返回 ...

  7. UltraISO制作使用(服务器装机u盘制作)

    1.准备工作: 1)U盘一个,需要格式化(大于4G,毕竟ISO文件就已经大于4G了) 2)CentOS7.1 iso文件一个(去这里下载:http://www.centoscn.com/) 3)Ult ...

  8. Java 回调函数例子

    首先定义一个类Caller,按照上面的定义就是程序员A写的程序a,这个类里面保存一个接口引用. public class Caller { private MyCallInterface callIn ...

  9. 物理standby database的日常维护

    1.停止Standby select process, status from v$managed_standby; --查看备库是否在应用日志进行恢复 alter database recover ...

  10. 2018-2019-2 20165302 《网络对抗技术》Exp3 免杀原理与实践

    一,实验要求 (我是真的不知道为什么截图中都有学号和姓名信息了还要求改主机名......而且实验要求里也没有明确说.做完之后听别人说的,肯定是不能重新截图了,要扣分就扣吧) 通过本部分内容的学习,认识 ...