fullcalendar - 来自未显示在 FullCalendar 4 中的实际日历中的数组的事件
问题描述
我尝试在 FullCalendar 生成的日历中模拟事件。
目前我只是从静态对象(一个可解析对象数组)中获取数据,以便初始化日历中的事件。
在我从我的本地存储中为这个 PoC 获取它之后。
var calendar = new FullCalendar.Calendar(calendarEl, {
timezone: 'UTC',
events: [
{title: "Repos de cycle", start: "2019-11-07T07:00:00.000Z", end: "2019-11-07T11:00:00.000Z"},
{title: "Repos de cycle", start: '2019-11-07T07:00:00.000Z', end: '2019-11-07T11:00:00.000Z'}
],
...
当我调用 eventRender 时,我实际上看到了从日历的“事件”属性中解析的事件对象
eventRender(info) {
console.log('rendered event : ', info.event)
},
在 web 开发者工具中,我实际上得到了我的两个 Event 对象
rendered event : e {_calendar: e, _def: {…}, _instance: {…}}
rendered event : e {_calendar: e, _def: {…}, _instance: {…}}
但是日历中没有显示任何内容。
我做错了什么?我应该强制重新渲染还是什么?因为无论发生什么,当我完成配置时,我已经渲染了我的日历。
这是当前情况的codepen:https ://codepen.io/nurovek/pen/zYYWGyX
解决方案
当您使用资源时,您需要resourceId
为事件定义。所以你应该这样设置。
events: [
{resourceId: '2', title: "Repos de cycle", start: "2019-11-07T07:00:00.000Z", end: "2019-11-07T11:00:00.000Z"},
{resourceId: '4', title: "Repos de cycle", start: '2019-11-07T07:00:00.000Z', end: '2019-11-07T11:00:00.000Z'}
],
推荐阅读
- c++ - 在编译时将强类型枚举器转换为其基础类型?
- php - 获取从 PHP 传递的 JS 中的树枝变量
- c# - C# 充气城堡 FipsDRBG
- ios - Swift 中的函数将运行,但不会在 Swift 中执行“完成”
- python - Python:将字符串拆分为变量
- azure - 在 Azure 中运行应用服务时 JWT 声明丢失
- mysql - debezium 0.8.0 mysql连接器解析binlog失败,table.columnWithName返回null,为什么会这样?
- javascript - 量角器中的元素不可见错误
- javascript - × 未处理的拒绝 (SyntaxError):JSON 中位置 0 处的意外标记 T
- java - 我怎么会得到一个空指针异常