我使用wp_enqueue_scripts action将fullcalendar.js包含在Wordress主题中。这是代码
wp_enqueue_script('moment', get_template_directory_uri().'/js/moment.min.js',array('jquery'), '1.0', true);
wp_enqueue_script('fullcalendar', get_template_directory_uri().'/js/fullcalendar.js',array('jquery','moment'), '1.0', true);
wp_enqueue_style('fullcalendarccs', trailingslashit( get_template_directory_uri() ) . 'css/fullcalendar.css');
但是,当我加载页面时,没有在任何容器上调用fullcalendar时,都会出现此错误。
TypeError: format is undefined[Learn More] fullcalendar.js:2534:9
dayOfMonthFormat
http://staynorwich.dievdesign.com/wp-content/themes/testintheme/js/fullcalendar.js:2534:9
locale/<
http://staynorwich.dievdesign.com/wp-content/themes/testintheme/js/fullcalendar.js:2652:32
each
http://staynorwich.dievdesign.com/wp-includes/js/jquery/jquery.js:2:2929
locale
http://staynorwich.dievdesign.com/wp-content/themes/testintheme/js/fullcalendar.js:2650:5
<anonymous>
http://staynorwich.dievdesign.com/wp-content/themes/testintheme/js/fullcalendar.js:2666:1
__webpack_require__
http://staynorwich.dievdesign.com/wp-content/themes/testintheme/js/fullcalendar.js:35:12
<anonymous>
http://staynorwich.dievdesign.com/wp-content/themes/testintheme/js/fullcalendar.js:1763:16
__webpack_require__
http://staynorwich.dievdesign.com/wp-content/themes/testintheme/js/fullcalendar.js:35:12
<anonymous>
http://staynorwich.dievdesign.com/wp-content/themes/testintheme/js/fullcalendar.js:12379:19
__webpack_require__
http://staynorwich.dievdesign.com/wp-content/themes/testintheme/js/fullcalendar.js:35:12
<anonymous>
http://staynorwich.dievdesign.com/wp-content/themes/testintheme/js/fullcalendar.js:78:18
<anonymous>
http://staynorwich.dievdesign.com/wp-content/themes/testintheme/js/fullcalendar.js:16:18
webpackUniversalModuleDefinition
http://staynorwich.dievdesign.com/wp-content/themes/testintheme/js/fullcalendar.js:14:26
<anonymous>
http://staynorwich.dievdesign.com/wp-content/themes/testintheme/js/fullcalendar.js:6:11
同样,我没有在任何容器上调用'.fullCalendar'-实际上,我删除了执行此操作的所有代码。
更新:我更改了wordpress中的dateformat设置,如果我将日期从December ...更改为12/21,则该错误不再存在。也许与Wordpress产生冲突?
谢谢