小编the*_*ose的帖子

在 React 中创建 FullCalendar 自定义按钮

我正在使用 React 实现 FullCalendar,并且想要添加自定义按钮。FullCalendar 文档涵盖了自定义按钮,但不适用于 React。

我已经尝试了文档中显示的自定义按钮代码的不同变体,但我无法在 React 中使用任何内容。我已将自定义按钮放入数组中。我尝试将自定义按钮代码移出渲染方法。

export default class DemoApp extends React.Component {

  calendarComponentRef = React.createRef()
  state = {
    calendarWeekends: true,
    calendarEvents: [ // initial event data
      { title: 'Event Now', start: new Date() }
    ]
  }

  render() {
    return (
      <div className='demo-app'>
        <div className='demo-app-top'>
          <button onClick={ this.toggleWeekends }>toggle weekends</button>&nbsp;
          <button onClick={ this.gotoPast }>go to a date in the past</button>&nbsp;
          (also, click a date/time to add an event)
        </div>
        <div className='demo-app-calendar'>
          <FullCalendar
            customButtons: {
                myCustomButton: {
                    text: …
Run Code Online (Sandbox Code Playgroud)

fullcalendar reactjs

2
推荐指数
1
解决办法
7968
查看次数

标签 统计

fullcalendar ×1

reactjs ×1