Fullcalendar dayRender 未定义单元格 属性
Fullcalendar dayRender does not define cell property
我使用 fullcalendar.io 插件,我想在日历的每个单元格中添加一些额外的 html,但在控制台中我收到以下错误:
Uncaught TypeError: Cannot read property 'append' of undefined
at Calendar.dayRender (mycode.js?v=1.x:31)
at Calendar.publiclyTrigger (main.js?v=1.x:6949)
at DayGrid.DateComponent.publiclyTrigger (main.js?v=1.x:4008)
at DayGrid._renderCells (main.js?v=1.x:796)
at DayGrid.res [as renderCells] (main.js?v=1.x:3189)
at DayGrid.render (main.js?v=1.x:740)
at DayGrid.Component.receiveProps (main.js?v=1.x:3887)
at SimpleDayGrid.render (main.js?v=1.x:1520)
at SimpleDayGrid.Component.receiveProps (main.js?v=1.x:3887)
at DayGridView.render (main.js?v=1.x:1586)
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
plugins: [ 'dayGrid', 'timeGrid', 'list' ],
defaultView: 'dayGridMonth',//'timeGridWeek',
header: {
left: 'prevYear,prev,next,nextYear today',
center: 'title',
right: 'dayGridMonth,timeGridWeek,timeGridDay,listWeek'
},
defaultDate: '2019-07-12',
editable: true,
eventLimit: true, // allow "more" link when too many events
dayRender: function(date, element) {
element.append("<input type=\"checkbox\">AM<br>");
}
});
我认为出于某种原因 dayRender 没有定义元素变量。为什么会发生这种情况?
在 Full Calendar v 4.0 中,按照 ADyson 的建议,使用 dayRender 如下:
dayRender: function (dayRenderInfo) {
dayRenderInfo.el.innerHTML = "<input type=\"checkbox\">AM<br>";
}
我使用 fullcalendar.io 插件,我想在日历的每个单元格中添加一些额外的 html,但在控制台中我收到以下错误:
Uncaught TypeError: Cannot read property 'append' of undefined at Calendar.dayRender (mycode.js?v=1.x:31) at Calendar.publiclyTrigger (main.js?v=1.x:6949) at DayGrid.DateComponent.publiclyTrigger (main.js?v=1.x:4008) at DayGrid._renderCells (main.js?v=1.x:796) at DayGrid.res [as renderCells] (main.js?v=1.x:3189) at DayGrid.render (main.js?v=1.x:740) at DayGrid.Component.receiveProps (main.js?v=1.x:3887) at SimpleDayGrid.render (main.js?v=1.x:1520) at SimpleDayGrid.Component.receiveProps (main.js?v=1.x:3887) at DayGridView.render (main.js?v=1.x:1586)
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
plugins: [ 'dayGrid', 'timeGrid', 'list' ],
defaultView: 'dayGridMonth',//'timeGridWeek',
header: {
left: 'prevYear,prev,next,nextYear today',
center: 'title',
right: 'dayGridMonth,timeGridWeek,timeGridDay,listWeek'
},
defaultDate: '2019-07-12',
editable: true,
eventLimit: true, // allow "more" link when too many events
dayRender: function(date, element) {
element.append("<input type=\"checkbox\">AM<br>");
}
});
我认为出于某种原因 dayRender 没有定义元素变量。为什么会发生这种情况?
在 Full Calendar v 4.0 中,按照 ADyson 的建议,使用 dayRender 如下:
dayRender: function (dayRenderInfo) {
dayRenderInfo.el.innerHTML = "<input type=\"checkbox\">AM<br>";
}