我正在React.js项目中实现fullcalendar.io。当我拖动事件时,有时会出现这个错误,有人能告诉我问题出在哪里吗?
Uncaught TypeError: Cannot read property 'isWithinClipping' of undefined
at HitDragging.queryHitForOffset (static/js/0.chunk.js:14463)
at HitDragging.handleMove (static/js/0.chunk.js:14427)
at EmitterMixin.HitDragging.handleDragMove (static/js/0.chunk.js:14360)
at applyAll (static/js/0.chunk.js:1629)
at EmitterMixin.triggerWith (static/js/0.chunk.js:4885)
at EmitterMixin.trigger (static/js/0.chunk.js:4879)
at EmitterMixin.FeaturefulElementDragging._this.onPointerMove (static/js/0.chunk.js:14113)
at applyAll (static/js/0.chunk.js:1629)
at EmitterMixin.triggerWith (static/js/0.chunk.js:4885)
at EmitterMixin.trigger (static/js/0.chunk.js:4879)
at HTMLDocument.PointerDragging.handleMouseMove (static/js/0.chunk.js:13229)
当用户调整特定事件的大小时使用此方法:
eventResize = arg => {
let event = {
id: arg.event.id,
start_date: arg.event.start,
end_date: arg.event.end,
allDay: arg.event.allDay
};
this.setState(prevState => (
{
events: prevState.events.map(
specificEvent => specificEvent.id === event.id ? {
...specificEvent,
start: event.start_date,
end: event.end_date,
allDay: event.allDay
} : specificEvent
)
}));
};
这里还有FullCalendar组件的选项最后一个选项是拖动事件-EventDrop,这个选项我从官方文档中得到
<FullCalendar
defaultView="dayGridMonth"
eventTimeFormat={{
hour: '2-digit',
minute: '2-digit',
hour12: false,
meridiem: false
}}
displayEventEnd={true}
timeZone={'local'}
defaultDate={new Date()}
firstDay={1}
header={{
left: 'dayGridMonth,timeGridWeek,timeGridDay',
center: 'title',
right: 'prev,next today'
}}
businessHours={[ // specify an array instead
{
daysOfWeek: [1, 2, 3, 4, 5],
startTime: '08:00', // 8am
endTime: '18:00' // 6pm
},
]}
plugins={[dayGridPlugin, timeGridPlugin, interactionPlugin, bootstrapPlugin, listPlugin]}
themeSystem={"bootstrap"}
events={this.state.events}
eventRender={this.eventRender}
dateClick={this.handleDateClick}
eventResize={this.eventResize}
eventClick={this.eventClicked}
selectMirror={true}
weekNumbers={true}
weekNumbersWithinDays={true}
selectable={true}
editable={true}
unselectAuto={true}
nowIndicator={true}
eventDrop={this.eventResize}
/>
组件中有一些已确认的错误导致了此错误:
第一个看起来像是您的错误
https://github.com/fullcalendar/fullcalendar/issues/5001-从eventDragStart更改validRange时出错https://github.com/fullcalendar/fullcalendar/issues/4817-在选择/拖动/调整大小时调用重新渲染资源导致错误
始终首先访问所使用的库的repo,并查看打开和关闭的问题
欢迎来到web开发的前沿;-(
这可能对某些人有帮助:当我通过calendarRef?.getCalendar().setOption('height', newHeight);
更改日历大小,然后将一些外部事件添加到日历中时,我总是收到相同的错误"isWithinClipping"。
为了解决这个问题,我在setOption
行之后添加了calendarRef?.getCalendar().rerenderEvents();
。