【问题标题】:Angular - FullCalendar dateClick not workingAngular - FullCalendar dateClick 不起作用
【发布时间】:2021-07-20 08:35:54
【问题描述】:

我使用的是FullCalendar 4.4.0 版。 dayClick 事件未在我的代码中触发。我的代码如下。

calendar.component.html

<full-calendar
defaultView="dayGridMonth"
[plugins]="calendarPlugins"
[events]="calendarEvents"
eventColor= '#6236ff'
eventBorderColor= '#6236ff'
eventTextColor='#ffffff'
(dateClick)="handleDateClick($event)"
></full-calendar>

calendar.component.ts

handleDateClick(event){
  console.log("day", event);
}

当我点击日期时,什么也没有发生。该事件未登录到控制台。

【问题讨论】:

  • dateClick 事件需要interaction 插件。你确定这个插件已经加载了吗?
  • @archelite 我不知道。非常感谢。它现在正在工作。

标签: javascript angular fullcalendar fullcalendar-4


【解决方案1】:

你需要将interactionPlugin添加到calendarPlugins

calendarPlugins = [dayGridPlugin, timeGrigPlugin, interactionPlugin];

这是我为你写的工作示例:https://stackblitz.com/edit/fullcalendar-angular-example-ebmz5j?file=src%2Fapp%2Fapp.component.ts

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-08-16
    • 1970-01-01
    • 1970-01-01
    • 2023-04-04
    • 2022-06-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多