javascript - 如何将工具提示添加到 fullcalander
问题描述
我无法让此日历中的不同事件显示工具提示,谁能告诉我如何做到这一点?
document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
schedulerLicenseKey: '0414383191-fcs-1575447448',
plugins: [ 'interaction', 'dayGrid', 'timeGrid', 'list', 'resourceTimeline' ],
now: '2019-08-07',
editable: false, // enable draggable events
aspectRatio: 1.8,
scrollTime: '00:00', // undo default 6am scrollTime
header: {
left: 'today prev,next',
center: 'title',
right: 'month,timeline3Months'
},
defaultView: 'resourceTimelineDay',
views: {
resourceTimelineThreeDays: {
type: 'resourceTimeline',
duration: { days: 3 },
buttonText: '3 days'
}
},
resourceLabelText: 'Rooms',
resources: [
{ id: 'a', title: 'Auditorium A' },
{ id: 'b', title: 'Auditorium B', eventColor: 'green' },
{ id: 'c', title: 'Auditorium C', eventColor: 'orange' },
{ id: 'd', title: 'Auditorium D', children: [
{ id: 'd1', title: 'Room D1' },
{ id: 'd2', title: 'Room D2' }
] },
{ id: 'e', title: 'Auditorium E' },
{ id: 'f', title: 'Auditorium F', eventColor: 'red' },
{ id: 'g', title: 'Auditorium G' },
{ id: 'h', title: 'Auditorium H' },
{ id: 'i', title: 'Auditorium I' },
{ id: 'j', title: 'Auditorium J' },
{ id: 'k', title: 'Auditorium K' },
{ id: 'l', title: 'Auditorium L' },
{ id: 'm', title: 'Auditorium M' },
{ id: 'n', title: 'Auditorium N' },
{ id: 'o', title: 'Auditorium O' },
{ id: 'p', title: 'Auditorium P' },
{ id: 'q', title: 'Auditorium Q' },
{ id: 'r', title: 'Auditorium R' },
{ id: 's', title: 'Auditorium S' },
{ id: 't', title: 'Auditorium T' },
{ id: 'u', title: 'Auditorium U' },
{ id: 'v', title: 'Auditorium V' },
{ id: 'w', title: 'Auditorium W' },
{ id: 'x', title: 'Auditorium X' },
{ id: 'y', title: 'Auditorium Y' },
{ id: 'z', title: 'Auditorium Z' }
],
eventRender: function(info) {
var tooltip = new Tooltip(info.el, {
title: info.event.extendedProps.description,
placement: 'top',
trigger: 'hover',
container: 'body'
});
},
events: [
{ id: '1', resourceId: 'b', start: '2019-08-07T02:00:00', end: '2019-08-07T07:00:00', title: 'event 1',description: 'description for event 1' },
{ id: '2', resourceId: 'c', start: '2019-08-07T05:00:00', end: '2019-08-07T22:00:00', title: 'event 2',description: 'description for event 2' },
{ id: '3', resourceId: 'd', start: '2019-08-06', end: '2019-08-08', title: 'event 3',description: 'description for event 3' },
{ id: '4', resourceId: 'e', start: '2019-08-07T03:00:00', end: '2019-08-07T08:00:00', title: 'event 4',description: 'description for event 4' },
{ id: '5', resourceId: 'f', start: '2019-08-07T00:30:00', end: '2019-08-07T02:30:00', title: 'event 5',description: 'description for event 5' }
]
});
calendar.render();
});
如果我删除 eventrender 函数,则会显示日历但没有工具提示。如果我按现在的方式运行压延机,则根本不会显示任何内容。我从 fullcalanders 示例中获取了 eventrender 部分,但可能应该将其添加到函数中的其他位置以使其正常工作。但我不知道在那种情况下......
解决方案
推荐阅读
- c++ - C++ 数组指针如何具有不同的位置,但指向同一个元素?
- windows - git show HEAD~1:.gitignore 命令导致 Windows 64 位中出现奇怪的字符
- bash - 如何使用带有 filter_complex 的 FFMPEG 将包含 40 多个音频文件的完整文件夹组合/加入到一个长 mp3 中?
- python - 无法将变量从有效负载传递到python中的url
- c# - 如何将子部分视图添加到父部分视图?
- sql-server - EF Core 3.1 无法查询 Json 序列化对象
- networking - 将 GITLAB 设置为可在 LAN 上访问
- python - 使用 matplotlib 绘制 pandas 数据框列时的空图例
- u-boot - 访问通过 tftp 加载的内存
- android - Android - dp 如何在不同尺寸的设备中占用不同的空间?