如何在FullCalendar Eventsources或EventsourcesUccess中为单个事件设置事件颜色
我使用的是具有FullCalendar 5的Eventsources。
每个事件源都会返回不同类型的事件,然后将其颜色不同。一个源将返回三种不同类型的事件,一个包装了三个数组的对象,而不是让源解析相同的日期范围3次,每次返回一个数组。这三种事件类型中的每一种都应以不同的方式进行颜色。
EventSources条目当前看起来像这样:
{
// Reservation types
url: '/reservations',
method: 'POST',
color: '#ffd5d5',
textColor: 'black',
eventClassNames: ['cal__reservations'],
},
返回是:
{
"type 1": [
{ "title": "type 1 title",
"start": "2022-05-02",
"end": "2022-05-02"}
},
"type 2": [
{ "title": "type 2 title",
"start": "2022-05-04",
"end": "2022-05-02"}
},
"type 3": [
{ "title": "type 3 title",
"start": "2022-05-24",
"end": "2022-05-24"}
}
}
我想解析此返回,以便每种类型都分配了不同的颜色,但是Eventsources似乎期望来自EventsOuncesuccess的单个数组,并且该事件颜色仍在静态上定义。在整个源的Eventsources中。
Eventsources或EventSourcesuccess有没有任何方法可以为每个事件分配颜色吗?
I'm using eventSources with FullCalendar 5.
Each event source returns a different type of event which is then colored differently. One source will return three different types of events, an object with three arrays wrapped, rather than having the source parse the same date range 3 times and return one array each time. Each of the three event types should be colored differently.
The eventSources entry currently looks like this:
{
// Reservation types
url: '/reservations',
method: 'POST',
color: '#ffd5d5',
textColor: 'black',
eventClassNames: ['cal__reservations'],
},
the return is:
{
"type 1": [
{ "title": "type 1 title",
"start": "2022-05-02",
"end": "2022-05-02"}
},
"type 2": [
{ "title": "type 2 title",
"start": "2022-05-04",
"end": "2022-05-02"}
},
"type 3": [
{ "title": "type 3 title",
"start": "2022-05-24",
"end": "2022-05-24"}
}
}
I would like to parse this return so that each type is assigned a different color, but it seems that eventSources is expecting a single array from eventSourceSuccess and that the event color is still statically defined within eventSources for each source as a whole.
Is there any way in eventSources or in eventSourceSuccess to conditionally assign a color to each event, individually?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论