gpt4 book ai didi

javascript - 如何修复未捕获的类型错误 : Cannot call method 'call' of undefined in fullcalendar

转载 作者:行者123 更新时间:2023-12-02 23:15:05 26 4
gpt4 key购买 nike

我正在使用phonegap开发应用程序,并且需要使用完整日历“可选择”功能。这些应用程序在手机上运行良好。但是当安装到平板电脑时,点击任何日历都会显示此错误:

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)

为什么它只发生在平板电脑上,但在我的手机上却工作正常

这些是我在 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>

这就是我创建日历的方式

    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();

更新:我使用三星 j5 pro(android oreo)作为我的手机测试设备,该设备可以正常工作。有问题的设备是我的三星 Galaxy Tab 3(Android Kitkat)。还尝试在 nox 播放器上安装应用程序,设置为手机和 table 。但也无法工作

最佳答案

看起来就像我在选项卡上运行代码时一样。 js 无法识别 Core/main.js 中提供的任何 matches 方法

我需要在第 107 行的 matches 方法选择期间添加 webkitMatchesSelector,以便代码在其他未定义的情况下使用该 matches 方法。

原文:

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

更新:

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

引用:https://github.com/matsko/ng4-animations-preview/issues/1

关于javascript - 如何修复未捕获的类型错误 : Cannot call method 'call' of undefined in fullcalendar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57197282/

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