为了结束这个问题的循环,我的实现有点像这样:
在 FullCalendar.js 的第 4662 行和第 4663 行之间添加了代码,以每天注入一个包含一个单元格的表格标签,并使用序列化日期添加 CSS 类属性来指示该单元格的日期:
html +=
"<div class='dayTableWrapper " + ((seg.isStart) ? "isStart" : "isEnd") + "'><table class='dayTable'><tr>";
for (var colNum = leftCol; colNum <= rightCol; colNum++) {
var classDateString = formatDate(t.cellDate({ row: seg.row, col: colNum }), 'u').substring(0, 10);
html +=
"<td class='dayContainer dayContainer-" + colNum + " date-" + classDateString + "'></td>";
}
html +=
"</tr></table></div>";
html +=
"</div>";
它产生这样的标记:
<div class="fc-event-inner fc-event-skin">
<span class="fc-event-title _fc1">Event Title</span>
<div class="dayTableWrapper isEnd">
<table class="dayTable">
<tbody>
<tr>
<td class="dayContainer dayContainer-0 date-2013-04-07"></td>
<td class="dayContainer dayContainer-1 date-2013-04-08"></td>
<td class="dayContainer dayContainer-2 date-2013-04-09"></td>
<td class="dayContainer dayContainer-3 date-2013-04-10"></td>
<td class="dayContainer dayContainer-4 date-2013-04-11"></td>
<td class="dayContainer dayContainer-5 date-2013-04-12"></td>
<td class="dayContainer dayContainer-6 date-2013-04-13"></td>
</tr>
</tbody>
</table>
</div>
</div>
然后,我能够按索引或日期值定位一周中的各个单元格,以便添加代表里程碑元素的图标图像。