TypeError:无法设置属性' fullCalendar'未定义的

时间:2016-06-23 07:56:37

标签: javascript jquery node.js fullcalendar

您好我使用fullCalendar jQuery插件使用以下反应组件:

import React from 'react';
import $ from 'jquery';
import moment from 'moment';
import fullCalendar from 'fullcalendar';

class calendarApp extends React.Component {
    componentDidMount(){
    $('#calendar').fullCalendar({
            defaultDate: '2014-09-12',
            editable: true,
            eventLimit: true,
     });
  }  render(){
      return(
         <div id="calendar">
         </div>
      );
    }
}

export default calendarApp;

我收到以下错误:

C:\Users\syedj\Desktop\newScheduler\node_modules\fullcalendar\dist\fullcalendar.js:28
$.fn.fullCalendar = function(options) {
                  ^

TypeError: Cannot set property 'fullCalendar' of undefined
    at C:\Users\syedj\Desktop\newScheduler\node_modules\fullcalendar\dist\fullcalendar.js:28:19
    at $.fullCalendar.version (C:\Users\syedj\Desktop\newScheduler\node_modules\fullcalendar\dist\fullcalendar.js:12:20)
    at Object.<anonymous> (C:\Users\syedj\Desktop\newScheduler\node_modules\fullcalendar\dist\fullcalendar.js:17:3)
    at Module._compile (module.js:541:32)
    at Module._extensions..js (module.js:550:10)
    at Object.require.extensions.(anonymous function) [as .js] (C:\Users\syedj\Desktop\newScheduler\node_modules\babel-register\lib\node.js:166:7)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (calendarApp.js:4:1)
    at Module._compile (module.js:541:32)
    at loader (C:\Users\syedj\Desktop\newScheduler\node_modules\babel-register\lib\node.js:158:5)
    at Object.require.extensions.(anonymous function) [as .js] (C:\Users\syedj\Desktop\newScheduler\node_modules\babel-register\lib\node.js:168:7)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (Calendar.js:6:1)
    at Module._compile (module.js:541:32)

我已经通过npm安装了jquery,moment和full calendar。我仍然不明白为什么我得到错误。非常感谢任何帮助,谢谢。

0 个答案:

没有答案