我在ReactJs组件上使用jQuery fullcalendar。jQuery fullCalendar在标题上显示为undefined
我对渲染方法<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
});
,它显示在标题为“不确定”的性格。 我哪里错了? 以及如何调试未定义的字符串来自哪里?
目前, 我做了被攻击的解决方案,通过增加从标题中移除所有未定义的字符串如下:
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'), ""); ;
},
有没有更好的解决办法?
我对事件使用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"}]
注:最后我赞成反应,大端倾销jQuery的完整的日历日历。
要介绍你得到在浏览器控制台的任何错误,当这个不确定的消息出现?你有没有在任何地方设置titleFormat? https://fullcalendar.io/docs/text/titleFormat/如果确实如此,请确保您指定的格式有效。 – ADyson
控制台上没有错误。它是一个小部件。我只用它来显示日历,所以仍然没有标题格式..我试图将其设置为titleFormat:'MMMM YYYY',但没有运气..没有线索如何调试标题。 –
如果您在ReactJS上下文之外使用它,它可以正常工作吗? – ADyson