【发布时间】:2020-06-26 05:37:33
【问题描述】:
https://fullcalendar.io/docs/v4/Calendar-gotoDate
我不知道如何在 vue.js 中使用 calendar.gotoDate(date)
例如 https://fullcalendar.io/docs/v4/defaultDate 访问 defaultDate 我只是将它添加到并工作,gotoDate 在这里不起作用。
<FullCalendar
:key="calendarRender"
ref="fullCalendar"
defaultView="dayGridMonth"
:header="{
left: 'prev,next today',
center: 'title',
right: ''
}"
:plugins="calendarPlugins"
:weekends="calendarWeekends"
:events="calendarEvents"
:selectable="true"
:selectOverlap="false"
@eventRender="eventRender"
:dayRender="dayRender"
:selectAllow="selectAllow"
:allDayDefault="false"
@select="select"
:showNonCurrentDates="false"
:fixedWeekCount="false"
:goToDate="currentDate"
/>
尝试使用,但两者都不起作用。在两个不是函数的情况下都出现错误。
this.$refs.fullCalendar.gotoDate(new Date('2020-08-11'));
this.$refs.fullCalendar.calendar.gotoDate(new Date('2020-08-11'));
目的是在我保存并强制它重新渲染以显示新数据后,它会返回到 Jun 而不是我正在处理的当前月份。
【问题讨论】:
-
运行
console.log(this.$refs.fullCalendar),然后在控制台中检查对象的内容以查找此gotoDate函数或属性在哪里。此外,请检查您的模板是否使用了正确的名称字母大小写 -gotoDate或goToDate。 -
感谢回答,我其实是用vue dev tool看的。
标签: javascript vue.js fullcalendar fullcalendar-4