In vue, solve the problem of warning, Added non-passive event listener to a scroll-blocking'mousewheel' event under chrome

1. The warning message is as follows:

In the vue+element project, solve the passive warning problem under chrome

element-ui.common.js?5c96:9972 [Violation] Added non-passive event listener to a scroll-blocking 'mousewheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952

Insert picture description here

Two, problem solving

  1. installation default-passive-events
yarn add default-passive-events
  1. It can be introduced in main.js
import "default-passive-events"; //添加事件管理者'passive',来阻止'touchstart'事件,让页面更加流畅。 解决chrome下的warning问题

Reference: https://www.jianshu.com/p/23850d4cade8

Guess you like

Origin blog.csdn.net/ddx2019/article/details/108827418