4.2.1
鼠标触摸 dataZoom-slider,会报event.js:160 Unable to preventDefault inside passive event listener invocation. 这个错.
Browser version [浏览器类型和版本]:Google Chrome 版本 79.0.3945.117(正式版本)

Version [操作系统类型和版本]: windows10 专业版
不报错.阻止默认行为.
控制台出现error
Hi! We've received your issue and please be patient to get responded. 🎉
The average response time is expected to be within one day for weekdays.
In the meanwhile, please make sure that you have posted enough image to demo your request. You may also check out the API and chart option to get the answer.
If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to [email protected]. Please attach the issue link if it's a technical questions.
If you are interested in the project, you may also subscribe our mail list.
Have a nice day! 🍵
这个bug还没解决吗?有没有大佬有解决方案
@yufeng04 chrome56 开始,在 window、document 和 body 上注册的 touchstart 和 touchmove 事件处理函数,会默认为是 passive: true。在这 3 个元素上的 touchstart 和 touchmove 事件处理函数中调用 e.preventDefault() ,会被浏览器忽略掉,并不会阻止默认行为。
那么如何解决这个问题呢?不让控制台提示,而且 preventDefault() 有效果呢?
两个方案:
1、注册处理函数时,用如下方式,明确声明为不是被动的
window.addEventListener('touchmove', func, { passive: false })
2、应用 CSS 属性 touch-action: none; 这样任何触摸事件都不会产生默认行为,但是 touch 事件照样触发。
touch-action 还有很多选项,详细请参考touch-action
[注]未来可能所有的元素的 touchstart touchmove 事件处理函数都会默认为 passive: true
内容来源于网络,非个人提出。
@yufeng04 chrome56 开始,在 window、document 和 body 上注册的 touchstart 和 touchmove 事件处理函数,会默认为是 passive: true。在这 3 个元素上的 touchstart 和 touchmove 事件处理函数中调用 e.preventDefault() ,会被浏览器忽略掉,并不会阻止默认行为。
那么如何解决这个问题呢?不让控制台提示,而且 preventDefault() 有效果呢?
两个方案:
1、注册处理函数时,用如下方式,明确声明为不是被动的
window.addEventListener('touchmove', func, { passive: false })2、应用 CSS 属性 touch-action: none; 这样任何触摸事件都不会产生默认行为,但是 touch 事件照样触发。
touch-action 还有很多选项,详细请参考touch-action[注]未来可能所有的元素的 touchstart touchmove 事件处理函数都会默认为 passive: true
内容来源于网络,非个人提出。
这个测试有效吗?我试了没效果
@chengmanxiang 这个是echarts的bug,我想是因为编码习惯导致的。因为我不止在一处发现这个bug,都是这种不规范的写法导致的。如果要修复这个bug,需要改的地方不知一处。这本身不算是一个bug,因为它仅仅是因为书写方式引起的问题。之前@他们的commiter,但是没有回应,可能太忙了
@chengmanxiang @GitHuplus 不好意思,确实忘记处理了,我会尽快处理这个问题
谢谢大佬