Uncaught Error: no element is specified to initialize PerfectScrollbar

Uncaught Error: no element is specified to initialize PerfectScrollbar

错误详细未捕获错误:没有指定元素来初始化PerfectScrollbar
版本:完美滚动条v1.5.3

Error from my web browser console


pscroll.js

(function ($) {
  "use strict";

  *const ps = new PerfectScrollbar(".app-sidebar", {
    useBothWheelAxes: true,
    suppressScrollX: true,
    suppressScrollY: false,
  });
  const ps1 = new PerfectScrollbar(".header-dropdown-list", {
    useBothWheelAxes: true,
    suppressScrollX: true,
    suppressScrollY: false,
  });
  const ps2 = new PerfectScrollbar(".notifications-menu", {
    useBothWheelAxes: true,
    suppressScrollX: true,
    suppressScrollY: false,
  });
  const ps3 = new PerfectScrollbar(".message-menu-scroll", {
    useBothWheelAxes: true,
    suppressScrollX: true,
    suppressScrollY: false,
  });

  //P-scrolling
*})(jQuery);


pscroll-1.js

(function($) {
    "use strict";

    *const ps11 = new PerfectScrollbar('.sidebar-right', {
        useBothWheelAxes: true,
        suppressScrollX: true,
    });


*})(jQuery);

我把错误行标成*.

在您发布 html 之后,我在文档中唯一能找到的 class 是 app-sidebar。你能确认你没有遗漏 html 中的这些 class 吗?

header-dropdown-list notifications-menu message-menu-scroll sidebar-right