Javascript render fullcalendar v4出现问题
我对版本4的渲染有问题。在第3版中,其操作如下:Javascript render fullcalendar v4出现问题,javascript,jquery,fullcalendar,Javascript,Jquery,Fullcalendar,我对版本4的渲染有问题。在第3版中,其操作如下: $('#mycalendar').fullCalendar('renderEvent', NuevoEvento); 在新版本中,它说它是这样的,但它不适合我: calendar.addEvent( event [, source ] )*/ $('btnAgregar')。单击(函数(){ 变量NuevoEvento={ 标题:$('#txtEvento').val(), 说明:$('#txtEvento').val(), 开始:$('#t
$('#mycalendar').fullCalendar('renderEvent', NuevoEvento);
在新版本中,它说它是这样的,但它不适合我:
calendar.addEvent( event [, source ] )*/
$('btnAgregar')。单击(函数(){
变量NuevoEvento={
标题:$('#txtEvento').val(),
说明:$('#txtEvento').val(),
开始:$('#txtFecha').val(),
};
日历.addEvent({
新事件
});
$('#registorevento').model('toggle');//cerrar model
});
更改
calendar.addEvent({
NuevoEvento
});
到
(即,删除{
和}
)。Fullcalendar需要具有顶级属性的事件对象。正确地说,您的NuevoEvento
变量已经是该格式的对象。当您添加它时,通过在它周围放置{
和}
,您使用JavaScript的对象文字语法将它包装在另一个对象中,fullCalendar无法理解它的结构。尝试calendar.addEvent(NuevoEvento)
而不是calendar.addEvent({NuevoEvento})代码>。
calendar.addEvent(
NuevoEvento
);