Javascript 如何在fullcalendar上自定义筛选器
有没有办法自定义完整日历上的筛选器?例如,我希望能够跳转到特定的月份或年份,而无需单击箭头键,以使其更友好,而不像单击需要花费太多时间。如果有-我如何定制它或需要什么代码 e、 g: 本月是九月,我想去十二月 本年度2019年,但我希望到2020年或更高 您可以使用函数“gotoDate” 像这样:Javascript 如何在fullcalendar上自定义筛选器,javascript,php,calendar,Javascript,Php,Calendar,有没有办法自定义完整日历上的筛选器?例如,我希望能够跳转到特定的月份或年份,而无需单击箭头键,以使其更友好,而不像单击需要花费太多时间。如果有-我如何定制它或需要什么代码 e、 g: 本月是九月,我想去十二月 本年度2019年,但我希望到2020年或更高 您可以使用函数“gotoDate” 像这样: <button id="btn">go to dec 2020</button> <script> document.addEventListener('DOM
<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');
});
});
转到2020年12月
document.addEventListener('DOMContentLoaded',function(){
var calendarEl=document.getElementById('calendar');
var calendar=新的完整日历。日历(calendarEl{
标题格式:{year:'numeric'},
插件:['dayGrid','timeGrid','list','moment','momentTimezone'],
标题:{
左:'',
中心:'标题',
右图:“上一年,下一年”
}
});
calendar.render();
//至2020年12月
$('#btn')。单击(函数(){
日历。哥多达特('2020-12-1');
});
});
在fullCalendar插件代码之前初始化“矩”库总是好的,但它也有助于添加一些注释或上下文,说明该代码如何解决原始问题。
<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');
});
});