有没有办法通过拖放添加来禁用 React Big Calendar 上特定视图的事件大小调整和拖动?
Is there a way to disable resizing and dragging of events for on specific views on React Big Calendar with drag and drop add on?
我在 API 文档中看不到任何允许在特定视图上禁用 resizing/drag 和删除事件的内容。
例如,如果我想仅在月视图中禁用 drag/drop 和调整事件大小的功能,但在日视图中保留该功能。
谢谢!
我能够通过以下方式做到这一点:
- 使用
onView
事件跟踪日历的视图状态,并在视图更改时设置状态。
- 为
resizeableAccessor
和 draggableAccessor
分配一个函数,如果当前视图设置为 "month" ,该函数解析为 false
const [currentView, setCurrentView] = useState(DEFAULT_VIEW);
<DnDCalendar
resizableAccessor={() => currentView !== 'month'}
draggableAccessor={() = > currentView !== 'month'}
onView={view => setCurrentView(view)}
...
/>
我在 API 文档中看不到任何允许在特定视图上禁用 resizing/drag 和删除事件的内容。
例如,如果我想仅在月视图中禁用 drag/drop 和调整事件大小的功能,但在日视图中保留该功能。
谢谢!
我能够通过以下方式做到这一点:
- 使用
onView
事件跟踪日历的视图状态,并在视图更改时设置状态。 - 为
resizeableAccessor
和draggableAccessor
分配一个函数,如果当前视图设置为 "month" ,该函数解析为 false
const [currentView, setCurrentView] = useState(DEFAULT_VIEW);
<DnDCalendar
resizableAccessor={() => currentView !== 'month'}
draggableAccessor={() = > currentView !== 'month'}
onView={view => setCurrentView(view)}
...
/>