繁体   English   中英

如何在事件渲染过程中修改FullCalendar上每个事件的css样式?

[英]How to modify the css style of each event on FullCalendar during the event rendering?

我正在使用FullCalendar v5插件在日历上显示事件。 我试图找到一种通过添加一些样式来改变元素的方法。

在版本 4 中,有一个名为eventRender: function (event, element) {}的 function 可以让我做到这一点。 但是,版本 5 中似乎不存在 function。

FullCalendar v5如何在渲染过程中操纵事件元素?

如果您查看从 v4 迁移到 v5 的文档,您会找到答案。

https://fullcalendar.io/docs/upgrading-from-v4

eventRender:改用新的事件渲染钩子

所以使用 v5,最适合你的是使用eventDidMount

例如

document.addEventListener('DOMContentLoaded', function () {
    var calendarEventsEl = document.getElementById('calendar-events');

    calendarEvents = new FullCalendar.Calendar(calendarEventsEl, {
        headerToolbar: false,
        contentHeight: 300,
        ...
        eventDidMount: function (arg) {
          // customize an event element here
        }
        ...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM