javascript - 如何在全日历上自定义过滤器
问题描述
有没有办法在完整日历上自定义过滤器?例如,我希望能够在不单击箭头键的情况下跳转到特定的月份或年份,使其更友好,而不像单击需要太多时间。如果有 - 我该如何定制它或需要什么代码?
例如:
当前月份是九月,我想去十二月
2019 年,但我想去 2020 年或更高
解决方案
您可以使用“gotoDate”功能
calendar.gotoDate('2020-12-1');
像这样 :
<button id="btn">go to dec 2020</button>
<script>
document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
titleFormat: {year: 'numeric'},
plugins: [ 'dayGrid', 'timeGrid', 'list', 'moment', 'momentTimezone'],
header:{
left: '',
center: 'title',
right: 'prevYear,nextYear'
}
});
calendar.render();
// go to dec 2020
$('#btn').click(function() {
calendar.gotoDate('2020-12-1');
});
});
考虑在 fullCalendar 插件之前初始化“时刻”库
推荐阅读
- google-cloud-platform - 使用 slackbot 发出经过身份验证的请求
- jquery - 在 fancybox 中,仅显示来自 lightbox 中特定 div 的照片
- python - 为什么 pikepdf 在使用 Acrobat DC 创建的 PDF 中填写某些 PDF 字段而不填写其他字段
- java - 登录后在导航抽屉中显示电子邮件
- python - 如何从 sklearn 预测中返回特征依赖百分比?
- node.js - 当我使用 Model.findOneAndUpdate 时,不会调用用于保存和更新的 Mongoose 预挂钩
- android - 在 Android 上更改 TabbedPage 项字体大小
- networking - 我无法使用 vlc 通过网络流式传输
- javascript - AssertionError: 预期 { Object (driver, name, ...) } 具有属性 '_id'
- swagger - Asp.NET Core 3.1 和 Swashbuckle.AspNetCore.Swagger