完整日历- React -如何在每月视图中禁用拖动事件



我目前正在使用React Full Calendar预订系统,我想在日历的月视图上禁用拖动。

我之前看过一篇关于如何做到这一点的文章,但这是使用jQuery,而不是React,因此我仍然卡住了。

这是我当前的日历:

我怎么可能在React完整日历中做到这一点?

谢谢。

<FullCalendar
plugins={[dayGridPlugin, timeGridPlugin, interactionPlugin]}
headerToolbar={{
left: "prev,next today",
center: "title",
right: "dayGridMonth,timeGridWeek,timeGridDay",
}}
height="auto"
initialView="timeGridWeek"
editable={true}
eventColor="#6DCBCA"
selectable={bookingLesson} // Allows a user to highlight multiple days or timeslots by clicking and dragging.
selectMirror={true}
dayMaxEvents={true}
allDaySlot={true}
weekends={true}
events={currentEvents}
select={handleDateSelect}
eventContent={renderEventContent}
eventClick={handleEventClick}
eventDrop={handleEventDrop}
eventDragStart={handleEventDragStart}
eventDragStop={handleEventDragStop}
eventConstraint={"lesson-available"}
selectConstraint={"lesson-available"}
selectOverlap={(event) => {
return !(event.groupId == "lesson-unavailable");
}}
slotDuration="00:60:00"
slotMinTime="6:00:00"
slotMaxTime="22:00:00"
/>

我想在视图名上加一个三进制就可以了

selectable={viewName === "dayGridMonth" ? false : true}

你可以通过fullcalendaref API获得viewName

最新更新