gpt4 book ai didi

javascript - fullcalendar 在 View 更改时执行某些操作

转载 作者:行者123 更新时间:2023-12-05 00:35:41 25 4
gpt4 key购买 nike

当 View 改变时我需要做一些事情。例如,当从 motnh 转到议程日时。

没有任何想法。任何想法?

viewRender:(function() {

var lastViewName;
return function(view) {

var view = $('#calendar').fullCalendar('getView');
alert('The new title of the view is ' + view.title);
}
}),


viewRender:(function(view) {
var view = $('#calendar').fullCalendar('getView');
alert('The new title of the view is ' + view.title);
}),

最佳答案

代码中的小错误。您想要 () 中的函数返回另一个函数,但它没有运行。正确的形式是:

(function() {
return function(){...};
})(); //extra parentheses run the function

这称为 Self-Executing Anonymous Function .

您的代码在您执行以下操作时有效:
viewRender: (function () {
var lastViewName;
return function (view) {
var view = $('#calendar').fullCalendar('getView');
alert('The new title of the view is ' + view.title);
}
})(),

关于javascript - fullcalendar 在 View 更改时执行某些操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32077654/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com