1

我正在尝试将基于 Fullcalendar 的旧 Web 应用程序转换为 V4。我不能dayClick开火。

我有这个 CodePen 示例:https ://codepen.io/anon/pen/YMMEyN?&editable=true&editors=001

该示例是通过来自 FC 网站的 lik=nk 初始化的。见下文。默认情况下它会显示一个dayGridMonth视图。它包含interaction插件dayClick,但无论我点击哪一天的单元格,该方法都不会触发。

    document.addEventListener('DOMContentLoaded', function() {
      var calendarEl = document.getElementById('calendar');

      var calendar = new FullCalendar.Calendar(calendarEl, {
        plugins: [ 'interaction', 'dayGrid', 'timeGrid' ],
        defaultView: 'dayGridMonth',
        defaultDate: '2019-04-07',
        header: {
          left: 'prev,next today',
          center: 'title',
          right: 'dayGridMonth,timeGridWeek,timeGridDay'
        },
        dayClick: function(info) {
                    alert("dayClick ");
        },
        events: [
          {
            title: 'All Day Event',
            start: '2019-04-01'
          },
          {
            title: 'Long Event',
            start: '2019-04-07',
            end: '2019-04-10'
          },
          {
            groupId: '999',
            title: 'Repeating Event',
            start: '2019-04-09T16:00:00'
          },
          {
            groupId: '999',
            title: 'Repeating Event',
            start: '2019-04-16T16:00:00'
          },
          {
            title: 'Conference',
            start: '2019-04-11',
            end: '2019-04-13'
          },
          {
            title: 'Meeting',
            start: '2019-04-12T10:30:00',
            end: '2019-04-12T12:30:00'
          },
          {
            title: 'Lunch',
            start: '2019-04-12T12:00:00'
          },
          {
            title: 'Meeting',
            start: '2019-04-12T14:30:00'
          },
          {
            title: 'Birthday Party',
            start: '2019-04-13T07:00:00'
          },
          {
            title: 'Click for Google',
            url: 'http://google.com/',
            start: '2019-04-28'
          }
        ]
      });

      calendar.render();
    });
4

1 回答 1

6

我认为您的意思dateClickdayClick

dateClick: function(info) {
    alert("dateClick");
},

供参考:dateClick() 文档

于 2019-04-29T17:55:32.187 回答