【问题标题】:Cannot read property 'options' of undefined无法读取未定义的属性“选项”
【发布时间】:2020-03-05 10:25:18
【问题描述】:

我正在使用调度程序的试用版。我尝试在此说明后插入自定义视图https://fullcalendar.io/docs/timeline-view

我得到一个错误

Uncaught TypeError: Cannot read property 'options' of undefined
    at i._renderSkeleton (main.min.js:6)
    at i.res [as renderSkeleton] (main.js:3189)
    at i.render (main.min.js:6)
    at i.Component.receiveProps (main.js:3887)
    at CalendarComponent.renderView (main.js:6277)
    at CalendarComponent.render (main.js:6202)
    at CalendarComponent.Component.receiveProps (main.js:3887)
    at Calendar.renderComponent (main.js:6817)
    at Calendar.executeRender (main.js:6774)
    at Calendar.tryRerender (main.js:6755)
    at Calendar.requestRerender (main.js:6747)
    at Calendar.dispatch (main.js:6735)
    at Calendar.changeView (main.js:7006)
    at HTMLButtonElement.buttonClick (main.js:6063)

这是我的代码的一部分:

var calendar = new FullCalendar.Calendar(calendarEl, {
                schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source',
                plugins: ['interaction', 'dayGrid', 'timeGrid', 'list', 'resourceTimeline'],
                defaultView: 'dayGridMonth',
                defaultDate: currentDate,
                editable: true,
                themeSystem: 'standard',
                locale: 'de',
                selectable: true,
                droppable: true,
                header: {
                    left: 'prev,next today createEvent',
                    center: 'title',
                    right: 'fourdays,dayGridMonth,timeGridWeek,timeGridDay,listWeek'
                },
                views: {
                    fourdays: {
                        type: 'resourceTimeline',
                        duration: { days: 4 },
                        buttonText: '4Days'
                    }
                }

仅当我更改为时间线视图时才发生。月、日、周和列表视图正在工作。知道如何解决这个问题吗?

【问题讨论】:

  • 无法使用 4.4.0 和您的代码重现您的错误。演示:codepen.io/ADyson82/pen/WNNeLNV。即使在视图之间切换,也不会出现控制台错误。也许您没有提供重现问题所需的所有代码/数据。你能分叉我的codepen并让它发生错误吗?有关创建有用示例/演示的指导,请参阅 stackoverflow.com/help/minimal-reproducible-example。然后我们可以了解错误是在您的代码中还是在 fullCalendar 中。

标签: javascript fullcalendar fullcalendar-scheduler fullcalendar-4


【解决方案1】:

我已降级到 v4.3.1,并且该错误不再出现。这显然是一个错误。

【讨论】:

  • 这并不是一个真正的解决方案,而是一种解决方法。
  • 我没有说这是一个解决方案,它只是关于我尝试过的信息
  • 如果您将其作为“答案”发布,最好通过解决问题来回答问题,而不是仅仅展示忽略问题的方法。特别是因为,根据我对上述线程的评论,还没有确凿的证据表明该错误存在于 fullCalendar 中(因此在等待发布修复程序时降级将是一个有用的解决方案。)
猜你喜欢
  • 2022-06-19
  • 2021-09-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-10-22
  • 1970-01-01
相关资源
最近更新 更多