未使用 PrimeNG Schedule 显示的事件无法读取 属性 scrollTop of null

Events not displaying with PrimeNG Schedule cannot read property scrollTop of null

我正在尝试使用 PrimeNG 的日程安排组件来为用户显示日历事件。日历显示,但是当 Fullcalendar 尝试呈现事件时它返回错误:
"ORIGINAL EXCEPTION: TypeError: Cannot read property 'scrollTop' of null"
事件应该是正确的格式,因为这个项目只是从 angular1 版本重构那已经在使用 Fullcalendar。下面我包含了 html、配置选项和试图显示的事件模拟。

template.html

        <p-schedule id="calendar" class="calendar" [events]="calendar.sources" 
            [calendar]="myCalendar1" [height]="calendar.config.height"
            [header]="calendar.config.header" [editable]="calendar.config.editable"
            [weekends]="calendar.config.weekends" [eventLimit]="calendar.config.eventLimit"
            (onDayClick)="calendar.config.dayClick" (onEventClick)="calendar.config.eventClick"
            (onEventDrop)="calendar.config.eventDrop">
        </p-schedule>


this.calendar.config = {
  height: 900,
  editable: true,
  weekends: true,
  eventLimit: true,
  header: {
    left: 'agendaDay,agendaWeek,month',
    center: 'title',
    right: 'today prev,next'
  },
  dayClick: this.dayClick,
  eventClick: this.eventClick,
  eventDrop: this.stopDrag
}


事实证明,无论我包含什么选项,fullcalendar 总是给出相同的错误。我什至尝试加载没有选项的计划模板,但仍然有同样的错误。这似乎表明我包含 Schedule 和 fullcalendar 的方式有些不正确。我通过 npm install --save 包含了 primeng 和 moment,然后我通过 html cdns 包含了 fullcalendar。我遵循了显示的实施更改 获得日程表和 运行。然后,我将 Schedule 作为提供者和指令添加到我当前的组件中。 Schedule 也包含在我的 class 构造函数中,因此我可以从我的组件的方法中引用它。

事实证明 JQuery 3.0.0 的更新与 Fullcalendar 不兼容。通过滚动 JQuery 回到 2.2.4 一切正常。

我在使用 fullcalendar 时遇到了同样的问题,Isahiro 的回答就是解决方案。我只是想补充一点,我的发生是因为与 bower 的依赖冲突将我的 jquery 升级为 3.x。您可以通过将以下内容添加到 bower.json.

来强制 Bower 使用 2.x 版本
"resolutions": {
   "jquery": "~2.1.4"
}