javascript - fullcalendar locale 未捕获类型错误 : e. fullCalendar.datepickerLocale 不是函数

标签 javascript jquery fullcalendar momentjs

我实现了一个 fullCalendar ,它工作正常,但是一旦我想更改区域设置,就会出现以下错误:

Uncaught TypeError: e.fullCalendar.datepickerLocale is not a function

以下是配置 fullCalendar 的 JS 代码:

loadScript("js/plugin/fullcalendar/locale-all.js", "");
fullviewcalendar = $('#calendar').fullCalendar({

        header: hdr,
                editable: true,
                droppable: true, // this allows things to be dropped onto the calendar !!!
                locale: 'fr',
                drop: function (date, allDay) { // this function is called when something is dropped

                    // retrieve the dropped element's stored Event Object
                    var originalEventObject = $(this).data('eventObject');

                    // we need to copy it, so that multiple events don't have a reference to the same object
                    var copiedEventObject = $.extend({}, originalEventObject);

                    // assign it the date that was reported
                    copiedEventObject.start = date;
                    copiedEventObject.allDay = allDay;

                    // render the event on the calendar
                    $('#calendar').fullCalendar('renderEvent', copiedEventObject, true);

                    // is the "remove after drop" checkbox checked?
                    if ($('#drop-remove').is(':checked')) {
                        // if so, remove the element from the "Draggable Events" list
                        $(this).remove();
                    }

                },

                select: function (start, end, allDay) {
                    var title = prompt('Event Title:');
                    if (title) {
                        calendar.fullCalendar('renderEvent', {
                                title: title,
                                start: start,
                                end: end,
                                allDay: allDay
                            }, true // make the event "stick"
                        );
                    }
                    calendar.fullCalendar('unselect');
                }


            });

我正在使用 jquery 1.12.4jqueryui 1.12.1 和 fullCalendar 3.1.0moment 2.17.1

如果我没有加载 local-all.js 脚本,我的日历会正确显示,但显示为英语...

您知道为什么我会收到此错误吗?

最佳答案

我知道这是一篇旧帖子,但供将来引用:

我刚刚发现这个函数在 fullCalendar v3 中从“Lang”重命名为“Locale”。

https://fullcalendar.io/docs/v3/lang

如果您遇到有关 v3+ 的兼容性问题,您可以尝试将函数 x.fullCalendar.datepickerLocale 更改为 x.fullCalendar.datepickerLang,反之亦然

为我工作,希望它对其他人也有用

关于javascript - fullcalendar locale 未捕获类型错误 : e. fullCalendar.datepickerLocale 不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41746842/

相关文章:

javascript - FullCalendar 自定义按钮图标未显示

javascript - 根据第一个表的行的降序总和创建另一个表

javascript - 如何使用 npm 以最少的所需文件启动 Angular2 项目?

javascript - 模块构建失败: SyntaxError: Unexpected token error when trying to render a second component

jQuery - 选择器

javascript - 通过单击与其关联的 <a> 来检查单选按钮

javascript - 如何使用 jquery 添加或删除局部 View Asp.net mvc?

javascript - 如何在不使用 arguments 属性的情况下找到参数数量?

javascript - Google 公共(public)日历链接不起作用(完整日历)

javascript - 如何将多个事件数据组合成一个适合与 fullcalendar 一起使用的对象或变量?