ECharts Mousewheel Event Listener Error: 'mousewheel' Event is Non-Passive
The error message indicates that the code is adding a non-passive event listener to a scroll-blocking 'mousewheel' event. This can cause the page to become unresponsive during scrolling. The error suggests marking the event handler as 'passive' to make the page more responsive.
To fix this issue, modify the event listener to include the 'passive' option. Here's an example:
mounted() {
var myChart = echarts.init(document.getElementById('main'));
myChart.getZr().on('mousewheel', function (event) {
// Handle the mousewheel event here
}, { passive: true });
// Rest of the code...
}
By adding { passive: true }, you inform the browser that the event handler won't perform any blocking operations, making the page more responsive.
原文地址: https://www.cveoy.top/t/topic/quIo 著作权归作者所有。请勿转载和采集!