簡體   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