【Vue】fullcalendar - next ,prev切换回调处理
·
1. fullcalendar 本身没有定义next ,prev按钮得回调函数, 需要在customButtons中添加自定义按钮
<FullCalendar class="app-calendar" ref="fullCalendar" :options="calendarOptions">
</FullCalendar>
calendarOptions:{
eventClick: this.handleEventClick, //点击日程触发
dateClick: this.handleDateClick, //点击日期触发
customButtons: {
next: {
click: this.nextClick
},
prev: {
click: this.prevClick
}
},
}
methods: {
// 上月点击
prevMonthCustomClick() {
this.$refs.fullCalendar.getApi().prev()
// this.$refs.fullCalendar.getApi().view.currentStart.getFullYear() 点击上个月得按钮获取当前年份 也可以获取月份等
},
// 下月点击
nextMonthCustomClick() {
this.$refs.fullCalendar.getApi().next()
},
}
2. 结束语
制作不易,点个关注再走吧

更多推荐
所有评论(0)