gpt4 book ai didi

reactjs - React fullcalendar错误无法读取未定义的属性 'seg'

转载 作者:行者123 更新时间:2023-12-02 19:14:05 26 4
gpt4 key购买 nike

我仅在移动 View 上使用 React fullcalendar 时收到标题错误。当我在桌面 View 中时,一切正常。代码如下:

function CalendarPage() {
const [currentEvents, setCurrentEvents] = useState(INITIAL_EVENTS);
console.log(currentEvents);

const handleDateSelect = (selectInfo) => {
let title = prompt('Please enter a new title for your event');
let calendarApi = selectInfo.view.calendar;

calendarApi.unselect(); // clear date selection

if (title) {
calendarApi.addEvent({
id: createEventId(),
title,
start: selectInfo.startStr,
end: selectInfo.endStr,
allDay: selectInfo.allDay
});
}
};

const handleEventClick = (clickInfo) => {
clickInfo.event.remove();
};

const handleEvents = (events) => {
setCurrentEvents({
currentEvents: events
});
};

function renderEventContent(eventInfo) {
return (
<>
<b>{eventInfo.timeText}</b>
<i>{eventInfo.event.title}</i>
</>
);
}

return (
<FullCalendar
plugins={[dayGridPlugin, timeGridPlugin, interactionPlugin]}
headerToolbar={{
left: 'prev,next,today',
center: 'title',
right: 'dayGridMonth,timeGridWeek,timeGridDay'
}}
initialView='dayGridMonth'
locale={el}
editable={true}
selectable={true}
selectMirror={true}
dayMaxEvents={true}
weekends={true}
initialEvents={currentEvents}
select={handleDateSelect}
eventContent={renderEventContent}
eventClick={handleEventClick}
eventsSet={handleEvents}
/>
);
}

我已阅读文档和 GitHub 页面,但遗憾的是没有找到解决方案。

我创建了一个codesandbox来重现错误:link

最佳答案

contentHeight: 'auto' 添加到日历的配置设置中。当日历在移动设备等较小尺寸上呈现时,就会发生这种情况

关于reactjs - React fullcalendar错误无法读取未定义的属性 'seg',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63906327/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com