简体   繁体   English

如何修复Uncaught TypeError:无法在fullcalendar中调用未定义的方法“ call”

[英]How to fix Uncaught TypeError: Cannot call method 'call' of undefined in fullcalendar

im developing an apps using phonegap and need to use fullcalendar 'selectable' functionalities. 我正在使用phonegap开发应用程序,并且需要使用全日历的“可选”功能。 the apps works fine in phone. 该应用程序在手机上可以正常工作。 but when installed to tablet, tapping on any of the calendar will shows this error: 但是将其安装到平板电脑时,点击任意日历都会显示此错误:

07-25 16:12:37.676: I/chromium(4707): [INFO:CONSOLE(128)] "Uncaught TypeError: Cannot call method 'call' of undefined", source: file:///android_asset/www/apis/fullcalendar/core/main.js (128) 07-25 16:12:37.676:I / chromium(4707):[INFO:CONSOLE(128)]“未捕获的TypeError:无法调用未定义的方法'call'”,来源:file:/// android_asset / www / apis /fullcalendar/core/main.js(128)

Why it only happens on tablet but on my phone it is working fine 为什么它仅在平板电脑上发生,但在我的手机上却能正常工作

these are the scripts that i've imported in my html: 这些是我在html中导入的脚本:

<link href='apis/fullcalendar/core/main.css' rel='stylesheet' />
<link href='apis/fullcalendar/daygrid/main.css' rel='stylesheet' />
<script src='apis/fullcalendar/core/main.js'></script>
<script src='apis/fullcalendar/interaction/main.js'></script>
<script src='apis/fullcalendar/daygrid/main.js'></script>

and this is how i create my calendar 这就是我创建日历的方式

    var today = moment().format('YYYY[-]MM[-]DD');
    var eventList = new Array();

    $.each(
        holidayDateList,
        function(i,v) {
            var events = {
                title: holidayNameList[i],
                start: v,
                backgroundColor: "#8c8c8c"
            };

            eventList.push(events);
        });

    $.each(
        offdayServerDateList,
        function(i,v) {
            var events = {
                title: offdayServerReasonList[i],
                start: v
            };

            eventList.push(events);
        });

    $.each(
        offdayDateList,
        function(i,v) {
            var events = {
                title: offdayReasonList[i],
                start: v
            };

            eventList.push(events);
        });

    var calendarEl = document.getElementById('calendar');

    var calendar = new FullCalendar.Calendar(calendarEl, {
        plugins: [ 'interaction', 'dayGrid' ],
        defaultDate: today,
        editable: false,
        selectable: true,
        selectMirror: true,
        select: function(arg) {
            var isToday = moment(arg.start).format('YYYY[-]MM[-]DD') == today;
            var isAfterToday = moment(arg.start).isAfter(today);
            var isHolidayDate = holidayDateList.indexOf(moment(arg.start).format('YYYY[-]MM[-]DD')) >= 0;
            var isOffdayDate = offdayServerDateList.indexOf(moment(arg.start).format('YYYY[-]MM[-]DD')) >= 0;

            if((isAfterToday || isToday) && !isHolidayDate && !isOffdayDate) {
                $("#dialog-form").dialog("open");
            }
        },
        eventLimit: true,
        eventClick: function(info) {
            var isOffdayDate = offdayServerDateList.indexOf(moment(info.event.start).format('YYYY[-]MM[-]DD')) >= 0;

            if(isOffdayDate) {
                alert("Open delete reason dialog for " + moment(info.event.start).format('YYYY[-]MM[-]DD'));
            } else {
                alert(info.event.title);
            }
        },
        events: eventList
    });

    calendar.render();

UPDATE: i use samsung j5 pro (android oreo) for my phone testing device which the device that can works without any problem. 更新:我为手机测试设备使用了三星j5 pro(android oreo),该设备可以正常工作。 the device that have problem is my samsung galaxy tab 3(android kitkat). 有问题的设备是我的三星银河标签3(android kitkat)。 also tried to install the apps on nox player set as phone and table. 还尝试将应用程序安装在设置为电话和桌子的nox播放器上。 but cannot work either 但也不能工作

Seems like when i run the code on my tab. 好像当我在选项卡上运行代码时。 The js doesn't recognize any of the matches method provided in Core/main.js js无法识别Core / main.js中提供的任何matchs方法

I need to add webkitMatchesSelector during the matches method selection on line 107 so the code use that matches method instead if others are undefined. 我需要在第107行的matchs方法选择期间添加webkitMatchesSelector,以便如果未定义其他代码,则代码将使用匹配方法。

Original: 原版的:

var matchesMethod = Element.prototype.matches ||
Element.prototype.matchesSelector ||
Element.prototype.msMatchesSelector;

Updated: 更新:

var matchesMethod = Element.prototype.matches ||
Element.prototype.matchesSelector ||
Element.prototype.msMatchesSelector || 
Element.prototype.webkitMatchesSelector; // add this

reference: https://github.com/matsko/ng4-animations-preview/issues/1 参考: https : //github.com/matsko/ng4-animations-preview/issues/1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Uncaught TypeError:无法调用未定义的方法“ then” - Uncaught TypeError: Cannot call method 'then' of undefined 未捕获的TypeError:无法调用未定义的方法&#39;indexOf&#39; - Uncaught TypeError: Cannot call method 'indexOf' of undefined 未捕获的TypeError:无法调用未定义的方法“ toLowerCase” - Uncaught TypeError: Cannot call method 'toLowerCase' of undefined 未捕获的TypeError:无法调用未定义的方法&#39;addEventListener&#39; - Uncaught TypeError: Cannot call method 'addEventListener' of undefined uncaught typeError:无法调用未定义的方法“ extend” - uncaught typeError: cannot call method 'extend' of undefined 未捕获的TypeError:无法调用未定义的方法'toLowerCase' - Uncaught TypeError: Cannot call method 'toLowerCase' of undefined 未捕获的TypeError:无法调用未定义的方法&#39;replace&#39; - Uncaught TypeError: Cannot call method 'replace' of undefined 未捕获的类型错误:无法调用未定义的方法“html” - Uncaught TypeError: Cannot call method 'html' of undefined 未捕获的TypeError:无法调用未定义的方法“ getLayer” - Uncaught TypeError: Cannot call method 'getLayer' of undefined 未捕获的TypeError:无法调用未定义的方法&#39;Pa&#39; - Uncaught TypeError: Cannot call method 'Pa' of undefined
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM