当eventSource可用时,我需要调用eventRender
$(function() {
function getEventSource () {
var ev;
setTimeout(function () {
ev = [
{
title : 'event00',
start : '2018-12-10',
imageUrl: 'https://cdn.shopify.com/s/files/1/0110/6032/files/0000-03_m.jpg?7389502659783226065'
},
{
title : 'event01',
start : '2018-12-12',
imageUrl: 'https://cdn.shopify.com/s/files/1/0110/6032/files/0000-03_m.jpg?7389502659783226065'
}
];
return ev;
}, 1000);
}
$('#calendar').fullCalendar({
defaultView: 'month',
header: {
center: 'addEventButton'
},
events: getEventSource(),
eventRender: function(event, eventElement) {
if (event.imageUrl) {
eventElement.find("div.fc-content").prepend("<img src='" + event.imageUrl +"' width='100%' height='150'>");
}
}
});
});
我最初的问题是我正在动态设置eventSource,例如this.$elem.fullCalendar('addEventSource', events);
一旦事件可用,就需要调用eventRender在日历上设置事件。
eventSource可用时(异步)可以调用eventRender吗?