fullcalendar V4 dayClick 不触发
fullcalendar V4 dayClick not firing
我正在尝试将旧的基于 Fullcalendar 的 Web 应用程序转换为 V4。我无法让 dayClick
开火。
我有这个 CodePen 示例:https://codepen.io/anon/pen/YMMEyN?&editable=true&editors=001
示例是通过来自 FC 网站的 lik=nk 初始化的。见下文。它默认显示 dayGridMonth
视图。它包括 interaction
插件,但 dayClick
方法不会触发,无论我点击哪一天的单元格。
document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
plugins: [ 'interaction', 'dayGrid', 'timeGrid' ],
defaultView: 'dayGridMonth',
defaultDate: '2019-04-07',
header: {
left: 'prev,next today',
center: 'title',
right: 'dayGridMonth,timeGridWeek,timeGridDay'
},
dayClick: function(info) {
alert("dayClick ");
},
events: [
{
title: 'All Day Event',
start: '2019-04-01'
},
{
title: 'Long Event',
start: '2019-04-07',
end: '2019-04-10'
},
{
groupId: '999',
title: 'Repeating Event',
start: '2019-04-09T16:00:00'
},
{
groupId: '999',
title: 'Repeating Event',
start: '2019-04-16T16:00:00'
},
{
title: 'Conference',
start: '2019-04-11',
end: '2019-04-13'
},
{
title: 'Meeting',
start: '2019-04-12T10:30:00',
end: '2019-04-12T12:30:00'
},
{
title: 'Lunch',
start: '2019-04-12T12:00:00'
},
{
title: 'Meeting',
start: '2019-04-12T14:30:00'
},
{
title: 'Birthday Party',
start: '2019-04-13T07:00:00'
},
{
title: 'Click for Google',
url: 'http://google.com/',
start: '2019-04-28'
}
]
});
calendar.render();
});
我想你的意思是 dateClick
而不是 dayClick
:
dateClick: function(info) {
alert("dateClick");
},
供参考: dateClick() docs
我正在尝试将旧的基于 Fullcalendar 的 Web 应用程序转换为 V4。我无法让 dayClick
开火。
我有这个 CodePen 示例:https://codepen.io/anon/pen/YMMEyN?&editable=true&editors=001
示例是通过来自 FC 网站的 lik=nk 初始化的。见下文。它默认显示 dayGridMonth
视图。它包括 interaction
插件,但 dayClick
方法不会触发,无论我点击哪一天的单元格。
document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
plugins: [ 'interaction', 'dayGrid', 'timeGrid' ],
defaultView: 'dayGridMonth',
defaultDate: '2019-04-07',
header: {
left: 'prev,next today',
center: 'title',
right: 'dayGridMonth,timeGridWeek,timeGridDay'
},
dayClick: function(info) {
alert("dayClick ");
},
events: [
{
title: 'All Day Event',
start: '2019-04-01'
},
{
title: 'Long Event',
start: '2019-04-07',
end: '2019-04-10'
},
{
groupId: '999',
title: 'Repeating Event',
start: '2019-04-09T16:00:00'
},
{
groupId: '999',
title: 'Repeating Event',
start: '2019-04-16T16:00:00'
},
{
title: 'Conference',
start: '2019-04-11',
end: '2019-04-13'
},
{
title: 'Meeting',
start: '2019-04-12T10:30:00',
end: '2019-04-12T12:30:00'
},
{
title: 'Lunch',
start: '2019-04-12T12:00:00'
},
{
title: 'Meeting',
start: '2019-04-12T14:30:00'
},
{
title: 'Birthday Party',
start: '2019-04-13T07:00:00'
},
{
title: 'Click for Google',
url: 'http://google.com/',
start: '2019-04-28'
}
]
});
calendar.render();
});
我想你的意思是 dateClick
而不是 dayClick
:
dateClick: function(info) {
alert("dateClick");
},
供参考: dateClick() docs