首页 > 解决方案 > 类型“CalendarOptions”.ts(2339) 上不存在属性“getDate”

问题描述

我正在尝试取回日历的当前月份和年份,但是我收到一条错误消息,上面写着“'CalendarOptions'.ts(2339) 类型上不存在属性'getDate'”。我正在使用这个日历https://fullcalendar.io/docs/Calendar-getDate。我已按照说明进行操作,尽管我使用的是打字稿并且说明是用 javascript 编写的。

getDate() {
  const getDates = this.calendarOptions.getDate();
}

上有一个错误下划线.getDate();。我查看了 API,并且该方法确实存在于包中。

下面是日历初始化

calendarOptions: CalendarOptions = {
plugins: [ dayGridPlugin, timeGridPlugin, interactionPlugin],
initialView: 'timeGridWeek',
headerToolbar: {
  left: 'prev,next', 
  center: 'title', 
  right: 'dayGridMonth,timeGridWeek,timeGridDay' 
},
dateClick: this.handleDateClick.bind(this), 
events: []
};

标签: angulardatefullcalendarfullcalendar-scheduler

解决方案


推荐阅读