没有显示react-big-calendar事件的基本设置 [英] Basic setup of react-big-calendar events not showing
本文介绍了没有显示react-big-calendar事件的基本设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用react-big-calendar软件包. http://intljusticemission.github.io/react-big-calendar/examples/index.html
Im trying to use the react-big-calendar package. http://intljusticemission.github.io/react-big-calendar/examples/index.html
我的日历显示在页面上.分页正常,控制台没有错误.但是我的活动都没有显示.我在某处是否存在语法/格式错误?
I have the calendar displaying on the page. The pagination is working and I have no errors in my console. However none of my events are showing. Do I have a syntax / format error somewhere?
import React from 'react';
import BigCalendar from 'react-big-calendar';
import moment from 'moment';
BigCalendar.momentLocalizer(moment); // or globalizeLocalizer
const Calendar = props => {
const dummyEvents = [
{
allDay: false,
end: new Date('December 10, 2017 11:13:00'),
start: new Date('December 09, 2017 11:13:00'),
title: 'hi',
},
{
allDay: true,
end: new Date('December 09, 2017 11:13:00'),
start: new Date('December 09, 2017 11:13:00'),
title: 'All Day Event',
},
];
return (
<div>
<BigCalendar
events={dummyEvents}
startAccessor="startDate"
endAccessor="endDate"
/>
</div>
)
}
推荐答案
您需要在日历上设置高度或最小高度:
You need to set a height or min height on the calendar:
.rbc-calendar {
min-height: 600px;
}
const dummyEvents = [
{
allDay: false,
end: new Date('December 09, 2017 20:00:00'),
start: new Date('December 09, 2017 06:00:00'),
title: 'hi',
}
]
这篇关于没有显示react-big-calendar事件的基本设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文