fullcalendar日程events接收到数据但是并没有渲染到前端页面上(已解决)

前端确认是能够接收到后端的数据而且跟前端预设的数据一模一样但是就是无法显示到前端上

我使用的fullcalendar版本是6.1.7,events使用数组形式[],fullcalendar文档是英文的,例子比较少就没发现这种方法,

解决方法

调用fullcalendar API进行事件移除

let calendarApi = this.$refs.calendar.getApi()

let events = calendarApi.getEvents();

if (events.length > 0) {

        _.forEach(events, event => {//_此处的下划线来自于Lodash,需要导入才能不报错

          event.remove()

        })

}

调用fullcalendar API进行事件添加

let calendarApi = this.$refs.calendar.getApi()

calendarApi.addEvent(event)

 

以上方法来自于vue中使用fullcalendar插件events无法动态渲染解决方案

vue中使用fullcalendar插件events无法动态渲染解决方案

posted @ 2023-05-14 21:39  Neo_y  阅读(743)  评论(0)    收藏  举报