有没有办法让 FullCalendar 在事件到期或正在进行时触发功能?
Is there any way to get FullCalendar to trigger a function when an Event is due or in progress?
有什么方法可以让 FullCalendar 在事件到期或进行中时触发功能?例如,我想弹出一个通知,说 FullCalendar 中列出的事件即将开始。
您始终可以使用 extendedProps
分配特殊属性:
var calendar = new Calendar(calendarEl, {
events: [
{
title: 'BCH237',
start: '2019-08-12T10:30:00',
end: '2019-08-12T11:30:00',
extendedProps: {
'isAboutToStart': true //'2019-08-12T11:30:00' - Date.Now() >
'isDue': false // Date.Now() > '2019-08-12T11:30:00'
},
description: 'Lecture'
}
// more events ...
],
eventDidMount: function(info) {
console.log(info.event.extendedProps);
// {description: "Lecture", isAboutToStart: "True", isDue: "False"}
}
});
并根据start
或end
属性设置此值。
来自文档:
A plain object holding miscellaneous other properties specified during
parsing. Receives properties in the explicitly given extendedProps
hash as well as other non-standard properties.
有什么方法可以让 FullCalendar 在事件到期或进行中时触发功能?例如,我想弹出一个通知,说 FullCalendar 中列出的事件即将开始。
您始终可以使用 extendedProps
分配特殊属性:
var calendar = new Calendar(calendarEl, {
events: [
{
title: 'BCH237',
start: '2019-08-12T10:30:00',
end: '2019-08-12T11:30:00',
extendedProps: {
'isAboutToStart': true //'2019-08-12T11:30:00' - Date.Now() >
'isDue': false // Date.Now() > '2019-08-12T11:30:00'
},
description: 'Lecture'
}
// more events ...
],
eventDidMount: function(info) {
console.log(info.event.extendedProps);
// {description: "Lecture", isAboutToStart: "True", isDue: "False"}
}
});
并根据start
或end
属性设置此值。
来自文档:
A plain object holding miscellaneous other properties specified during parsing. Receives properties in the explicitly given extendedProps hash as well as other non-standard properties.