小编Gra*_*van的帖子

jQuery fullCalendar在标题上显示未定义

我在ReactJs组件上使用jQuery fullcalendar.

我有一个 <div id="calendar"></div>渲染方法

在componentDidUpdate上,我使用以下代码更新了日历:

$('#calendar').fullCalendar({
header: {
    left: 'prev,next today',
    center: 'title',
    right: 'month,agendaWeek,agendaDay'
},

events: _this.state.events,
defaultView:'month',
displayEventTime: false,
editable: false,
droppable: false,
durationEditable: false
});
Run Code Online (Sandbox Code Playgroud)

它在标题上显示"未定义"字符.我哪里做错了?以及如何调试未定义字符串的来源?

jquery完整的日历

目前,我做了一个被黑客攻击的解决方案,通过添加以下内容从标题中删除所有未定义的字符串:

viewRender: function(view, element) {
//note: this is a hack, i don't know why the view title keep showing "undefined" text in it.
//probably bugs in jquery fullcalendar
$('.fc-center')[0].children[0].innerText = view.title.replace(new RegExp("undefined", 'g'), ""); ;

},
Run Code Online (Sandbox Code Playgroud)

还有更好的解决方案吗?

我正在使用jquery FullCalendar v2.9.1

以下有关事件的示例数据:

[{"start":"2017-03-24T00:00:00.000Z","end":"2017-03-26T00:00:00.000Z","title":"Open house","description":"Bali 1 open house"}]
Run Code Online (Sandbox Code Playgroud)

注意:我最终倾倒了jquery完整日历,转而使用react-big-calendar.

javascript jquery jsx fullcalendar reactjs

14
推荐指数
2
解决办法
6176
查看次数

标签 统计

fullcalendar ×1

javascript ×1

jquery ×1

jsx ×1

reactjs ×1