首页 > 解决方案 > FullLCalendar 5:每个事件源的不同颜色不会显示在月视图中

问题描述

我有两个事件源,配置如下:

this.eventSources = {
        1: {
            id: 1,
            color: '#228B22',
            textColor: '#000000',
            backgroundColor: '#90EE90',
            url: this.config.loadUrl,
            startParam: 'from',
            endParam: 'to',
            extraParams: {
                client_id: 0,
                agenda_item_type_id: 1
            }
        },
        2: {
            id: 2,
            color: '#0e64a0',
            textColor: '#000000',
            backgroundColor: '#87CEFA',
            url: this.config.loadUrl,
            startParam: 'from',
            endParam: 'to',
            extraParams: {
                client_id: 0,
                agenda_item_type_id: 2
            }
        }
    };

我之前calender.render()这样设置它们:

Object.values(this.agendaItemTypes).forEach(itemType => {
    if (itemType.initiallyVisible) {
        this.calendar.addEventSource(this.eventSources[itemType.id]);
    }
});

this.calendar.render();

这工作正常。初始渲染后,仅initiallyVisible显示事件。使用复选框,我可以切换每个事件类型的可见性,这几乎可以按预期工作。只有颜色没有按预期显示。使用标准主题,dayGridMonth视图中的项目符号显示在配置的color. 除此之外,事件以默认颜色显示,似乎忽略了事件源的textColorbackgroundColor

我是否遗漏了文档中的某些内容,或者有什么明显的我做错了?

标签: fullcalendarfullcalendar-5

解决方案


推荐阅读