我正在尝试使用以下代码在弹出式qtip2工具提示中正确显示该事件。
element.qtip({
content: {
title: { text: event.title },
text: '<span class="qtip-title">Starts: </span>' + ($.fullCalendar.formatDate(event.start, 'h:mm a')) + '<br>' + '<span class="qtip-title">Ends: </span>' + event.end + '<br>' + '<span class="qtip-title">Venue: </span>' + event.location + '<br>' + '<span class="qtip-title">Description: </span>' + event.description
},
...
使用以下代码正确显示事件开始时间:
($.fullCalendar.formatDate(event.start, 'h:mm a'))
并使用代码将事件结束时间显示为一串数字(ISO8601字符串?):
event.end
如果我尝试替换为:
($.fullCalendar.formatDate(event.end, 'h:mm a'))
或:
event.end.format('h:mm a ddd')
日历完全无法显示。注意:代码:event.start.format('h:mm a ddd')也会正确显示开始时间。
显然我做错了什么。任何建议都将不胜感激。
进一步更新:控制台日志
使用以下代码:
content: {
title: { text: event.title },
text: '<span class="qtip-title">Starts: </span>' + event.start.format('h:mm a') + '<br>' + '<span class="qtip-title">Ends: </span>' + event.end.format('h:mm a') + '<br>' + '<span class="qtip-title">Venue: </span>' + event.location + '<br>' + '<span class="qtip-title">Description: </span>' + event.description
},
...
返回以下控制台日志数据:
unreachable code after return statement[Learn More] js:69:1217
jQuery.Deferred exception: event.end is null eventRender@http://example.com/site/templates/scripts/hnu-calendar.js:80:66
H</t.prototype.publiclyTrigger@http://example.com/scripts-mx/fullcalendar.3.9.0.min.js:10:2065
p</e.prototype.publiclyTrigger@http://example.com/scripts-mx/fullcalendar.3.9.0.min.js:9:25413
o</t.prototype.filterEventRenderEl@http://example.com/scripts-mx/fullcalendar.3.9.0.min.js:7:29788
o</t.prototype.renderFgSegEls/<@http://example.com/scripts-mx/fullcalendar.3.9.0.min.js:7:29235
each@https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js:2:2813
each@https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js:2:1001
o</t.prototype.renderFgSegEls@http://example.com/scripts-mx/fullcalendar.3.9.0.min.js:7:29187
o</t.prototype.renderFgRanges@http://example.com/scripts-mx/fullcalendar.3.9.0.min.js:7:27940
o</t.prototype.render@http://example.com/scripts-mx/fullcalendar.3.9.0.min.js:7:27699
p</e.prototype.executeEventRender@http://example.com/scripts-mx/fullcalendar.3.9.0.min.js:9:26656
p</e.prototype.callChildren/<@http://example.com/scripts-mx/fullcalendar.3.9.0.min.js:9:31088
p</e.prototype.iterChildren@http://example.com/scripts-mx/fullcalendar.3.9.0.min.js:9:31182
p</e.prototype.callChildren@http://example.com/scripts-mx/fullcalendar.3.9.0.min.js:9:31058
p</e.prototype.executeEventRender@http://example.com/scripts-mx/fullcalendar.3.9.0.min.js:9:26729
p</e.prototype.requestEventsRender/<@http://example.com/scripts-mx/fullcalendar.3.9.0.min.js:7:18403
o</e.prototype.runTask@http://example.com/scripts-mx/fullcalendar.3.9.0.min.js:9:23735
r</t.prototype.runRemaining@http://example.com/scripts-mx/fullcalendar.3.9.0.min.js:9:22352
r</t.prototype.tryStart@http://example.com/scripts-mx/fullcalendar.3.9.0.min.js:9:22182
r</t.prototype.resume@http://example.com/scripts-mx/fullcalendar.3.9.0.min.js:9:21984
p</e.prototype.stopBatchRender@http://example.com/scripts-mx/fullcalendar.3.9.0.min.js:7:15515
e@http://example.com/scripts-mx/fullcalendar.3.9.0.min.js:6:16679
dispatch@https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js:3:10263
add/q.handle@https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js:3:8325
trigger@https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js:4:5806
triggerHandler@https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js:4:6394
s</e.prototype.trigger@http://example.com/scripts-mx/fullcalendar.3.9.0.min.js:6:16925
a</e.prototype.setProps@http://example.com/scripts-mx/fullcalendar.3.9.0.min.js:8:4635
a</e.prototype.set@http://example.com/scripts-mx/fullcalendar.3.9.0.min.js:8:4028
a</e.prototype.watch/this._watchers[t]</<@http://example.com/scripts-mx/fullcalendar.3.9.0.min.js:8:4864
j@https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js:2:29946
g/</k<@https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js:2:30262
undefined jquery.min.js:2:31515
随后是这个输出:
BackgroundThumbnails remote process crashed - recovering BackgroundPageThumbs.jsm:256
Error: page-thumbnail:error BackgroundPageThumbs.jsm:116:24
TelemetryStopwatch: requesting elapsed time for nonexisting stopwatch. Histogram: "PLACES_AUTOCOMPLETE_1ST_RESULT_TIME_MS", key: "null" TelemetryStopwatch.jsm:363
TelemetryStopwatch: requesting elapsed time for nonexisting stopwatch. Histogram: "PLACES_AUTOCOMPLETE_1ST_RESULT_TIME_MS", key: "null" TelemetryStopwatch.jsm:363
TelemetryStopwatch: requesting elapsed time for nonexisting stopwatch. Histogram: "PLACES_AUTOCOMPLETE_1ST_RESULT_TIME_MS", key: "null" TelemetryStopwatch.jsm:363
BackgroundThumbnails remote process crashed - recovering BackgroundPageThumbs.jsm:256
错误:page-thumbnail:错误BackgroundPageThumbs.jsm:116:24 TelemetryStopwatch:请求不用秒表的经过时间。直方图:“PLACES_AUTOCOMPLETE_1ST_RESULT_TIME_MS”,密钥:“null”TelemetryStopwatch.jsm:363 TelemetryStopwatch:请求不用秒表的经过时间。直方图:“PLACES_AUTOCOMPLETE_1ST_RESULT_TIME_MS”,密钥:“null”TelemetryStopwatch.jsm:363 BackgroundThumbnails远程进程崩溃 - 恢复BackgroundPageThumbs.jsm:256 错误:page-thumbnail:错误BackgroundPageThumbs.jsm:116:24 TelemetryStopwatch:请求不用秒表的经过时间。直方图:“PLACES_AUTOCOMPLETE_1ST_RESULT_TIME_MS”,密钥:“null”TelemetryStopwatch.jsm:363 TelemetryStopwatch:请求不用秒表的经过时间。直方图:“PLACES_AUTOCOMPLETE_1ST_RESULT_TIME_MS”,密钥:“null”TelemetryStopwatch.jsm:363 TelemetryStopwatch:请求不用秒表的经过时间。直方图:“PLACES_AUTOCOMPLETE_1ST_RESULT_TIME_MS”,密钥:“null”TelemetryStopwatch.jsm:363 TelemetryStopwatch:请求不用秒表的经过时间。直方图:“PLACES_AUTOCOMPLETE_1ST_RESULT_TIME_MS”,密钥:“null”TelemetryStopwatch.jsm:363 BackgroundThumbnails远程进程崩溃 - 恢复BackgroundPageThumbs.jsm:256 错误:page-thumbnail:错误BackgroundPageThumbs.jsm:116:24 TelemetryStopwatch:请求不用秒表的经过时间。直方图:“PLACES_AUTOCOMPLETE_1ST_RESULT_TIME_MS”,密钥:“null”TelemetryStopwatch.jsm:363 BackgroundThumbnails远程进程崩溃 - 恢复BackgroundPageThumbs.jsm:256 错误:page-thumbnail:错误BackgroundPageThumbs.jsm:116:24 TelemetryStopwatch:请求不用秒表的经过时间。直方图:“PLACES_AUTOCOMPLETE_1ST_RESULT_TIME_MS”,密钥:“null”TelemetryStopwatch.jsm:363 TelemetryStopwatch:请求不用秒表的经过时间。直方图:“PLACES_AUTOCOMPLETE_1ST_RESULT_TIME_MS”,密钥:“null”TelemetryStopwatch.jsm:363 TelemetryStopwatch:请求不用秒表的经过时间。直方图:“PLACES_AUTOCOMPLETE_1ST_RESULT_TIME_MS”,密钥:“null”TelemetryStopwatch.jsm:363 BackgroundThumbnails远程进程崩溃 - 恢复BackgroundPageThumbs.jsm:256 错误:page-thumbnail:错误BackgroundPageThumbs.jsm:116:24 BackgroundThumbnails远程进程崩溃 - 恢复BackgroundPageThumbs.jsm:256 错误:page-thumbnail:错误BackgroundPageThumbs.jsm:116:24 使用document.write()编写了一个不平衡的树,导致重新分析来自网络的数据。有关更多信息https://developer.mozilla.org/en/Optimizing_Your_Pages_for_Speculative_Parsing container.html:8 使用document.write()编写了一个不平衡的树,导致重新分析来自网络的数据。有关更多信息https://developer.mozilla.org/en/Optimizing_Your_Pages_for_Speculative_Parsing container.html:8 使用document.write()编写了一个不平衡的树,导致重新分析来自网络的数据。有关更多信息https://developer.mozilla.org/en/Optimizing_Your_Pages_for_Speculative_Parsing container.html:8 a:计时器startedsca.17.4.72.js:32 a:0.84mssca.17.4.72.js:32 WebRTC与“moz”前缀(mozRTCPeerConnection,mozRTCSessionDescription,mozRTCIceCandidate)的接口已被弃用。 sca.17.4.72.js:33:4653 此网站似乎使用滚动链接定位效果。这可能不适用于异步平移;有关详细信息,请参阅https://developer.mozilla.org/docs/Mozilla/Performance/ScrollLinkedEffects并加入有关相关工具和功能的讨论!修改
第一行是https://www.googletagmanager.com/gtag/js?id= .... 第二行的第一部分...... hnu-calendar.js:80:66该文件的第66行引用以下代码的第二行:
bootstrapFontAwesome: {
close: 'fa-times',
prev: 'fa-angle-left',
next: 'fa-angle-right',
prevYear: 'fa-angle-double-left',
nextYear: 'fa-angle-double-right'
},
最终结果是空白日历,如果我只是从内容部分删除以下内容:
'<span class="qtip-title">Ends: </span>' + event.end.format('h:mm a') + '<br>' +
虽然弹出式qtip工具提示中缺少结束时间,但日历显示正常。