如何在 fullCalendar 的标题中添加纯文本

ash*_*afi 4 javascript jquery fullcalendar

我使用了 fullCalendar.js 和标题内容,例如:今天、月份、年份、上一个、下一个,并且还制作了一个自定义添加按钮,现在我想在添加按钮之前的标题中添加一个简单的文本,上面写着“请求新类” ”,最终看起来像这样:fullCalendar Header

现在我的标题看起来像这样:我的标题

这是到目前为止的代码:

$('#sfullCalendar').fullCalendar({
  customButtons: {
        myCustomButton: {
            theme: 'true',
            text: '',
            click: function() {
                alert('clicked the custom button!');
            }
        }
    },
      defaultView: 'month',
      header: {
        left:   'today',
        center: 'title',
        right:  'prev,next myCustomButton'
      },
      });
Run Code Online (Sandbox Code Playgroud)
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
Run Code Online (Sandbox Code Playgroud)

Krz*_*zak 6

你可以试试:

    $('#calendar').fullCalendar({
  customButtons: {
    myCustomButton: {
      theme: 'true',
      text: '',
      click: function() {
        alert('clicked the custom button!');
      }
    }
  },
  defaultView: 'month',
  header: {
    left: 'today',
    center: 'title',
    right: 'prev,next myCustomButton'
  },
  eventAfterAllRender: function(view) {
    if ($('.label').length == 0) {
      $('.fc-myCustomButton-button').before('<div class="label">test</div>');
    }
  }
});
Run Code Online (Sandbox Code Playgroud)

小提琴