在 React App 中使用 Fullcalendar 方法

Vla*_*adR 2 javascript fullcalendar reactjs fullcalendar-4

Fullcalendar 事件可以被传递到对象的 props 中的 handlerlres 拦截:

<FullCalendar
    eventDrop={ this.handleInternalDrop }                     
/>
Run Code Online (Sandbox Code Playgroud)

如何使用 getEvents() 等 Fullcalendar 方法? https://fullcalendar.io/docs/Calendar-getEvents

Vla*_*adR 5

以下是使用 getEvents() 方法的示例:

export default class DemoApp extends React.Component {

  calendarRef = React.createRef()

  render() {
    return (
      <FullCalendar ref={this.calendarRef} />
    )
  }

  someMethod() {
    let calendarApi = this.calendarRef.current.getApi()
    calendarApi.getEvents()
  }

}
Run Code Online (Sandbox Code Playgroud)