如何在单击时更改全日历中的默认视图

How to change the default view in fullcalendar on Click

我的 fullcalendar 的默认视图是月份我想在按钮外部按钮单击时将视图从月份更改为 agendaDay。我想知道有什么内置函数可以在单击按钮时更改它。

$('#calendar').fullCalendar({
            header: {
                left: 'prev,next today',
                center: 'title',
                right: 'month,agendaWeek,agendaDay'
            },
            defaultDate: '2014-06-12',
            defaultView: 'month',
            editable: true,
            events: [
                {
                    title: 'All Day Event',
                    start: '2014-06-01'
                },
                {
                    title: 'Long Event',
                    start: '2014-06-07',
                    end: '2014-06-10'
                },
                {
                    id: 999,
                    title: 'Repeating Event',
                    start: '2014-06-09T16:00:00'
                },
                {
                    id: 999,
                    title: 'Repeating Event',
                    start: '2014-06-16T16:00:00'
                },
                {
                    title: 'Meeting',
                    start: '2014-06-12T10:30:00',
                    end: '2014-06-12T12:30:00'
                },
                {
                    title: 'Lunch',
                    start: '2014-06-12T12:00:00'
                },
                {
                    title: 'Birthday Party',
                    start: '2014-06-13T07:00:00'
                },
                {
                    title: 'Click for Google',
                    url: 'http://google.com/',
                    start: '2014-06-28'
                }
            ]
        });

    });

http://fullcalendar.io/docs/views/changeView/

$('#calendar').fullCalendar( 'changeView', 'agendaDay');

在脚本中添加这段代码。它会将默认视图从月更改为议程日。

defaultView: 'agendaDay'