我最近进入了nextJ,我想使用全卡伦达进行react,并且它不起作用,它不断地说我没有定义我的fullcalendar。我认为原因是因为它是从服务器渲染的,而jQuery却没有识别,我有什么办法可以做到吗?
Cannot set property 'fullCalendar' of undefined
TypeError: Cannot set property 'fullCalendar' of undefined
at Object.<anonymous> (C:UsersjarkaOneDriveDesktophr-websitehr-next-graphqlnextnode_modulesfullcalendar-reactwrapperlibindex.js:26051:19)
at $.fullCalendar.version (C:UsersjarkaOneDriveDesktophr-websitehr-next-graphqlnextnode_modulesfullcalendar-reactwrapperlibindex.js:26028:37)
at Object.map../af (C:UsersjarkaOneDriveDesktophr-websitehr-next-graphqlnextnode_modulesfullcalendar-reactwrapperlibindex.js:26037:3)
at __webpack_require__ (C:UsersjarkaOneDriveDesktophr-websitehr-next-graphqlnextnode_modulesfullcalendar-reactwrapperlibindex.js:30:30)
at Object.defineProperty.value (C:UsersjarkaOneDriveDesktophr-websitehr-next-graphqlnextnode_modulesfullcalendar-reactwrapperlibindex.js:25910:21)
at __webpack_require__ (C:UsersjarkaOneDriveDesktophr-websitehr-next-graphqlnextnode_modulesfullcalendar-reactwrapperlibindex.js:30:30)
at Object.<anonymous> (C:UsersjarkaOneDriveDesktophr-websitehr-next-graphqlnextnode_modulesfullcalendar-reactwrapperlibindex.js:41903:18)
at __webpack_require__ (C:UsersjarkaOneDriveDesktophr-websitehr-next-graphqlnextnode_modulesfullcalendar-reactwrapperlibindex.js:30:30)
at C:UsersjarkaOneDriveDesktophr-websitehr-next-graphqlnextnode_modulesfullcalendar-reactwrapperlibindex.js:76:18
at C:UsersjarkaOneDriveDesktophr-websitehr-next-graphqlnextnode_modulesfullcalendar-reactwrapperlibindex.js:79:10
at webpackUniversalModuleDefinition (C:UsersjarkaOneDriveDesktophr-websitehr-next-graphqlnextnode_modulesfullcalendar-reactwrapperlibindex.js:3:20)
at Object.<anonymous> (C:UsersjarkaOneDriveDesktophr-websitehr-next-graphqlnextnode_modulesfullcalendar-reactwrapperlibindex.js:10:3)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
您可能需要升级到fullcalendar v4,因为它不取决于jQuery使其易于与React集成。它还具有最近发布的官方FullCalendar React组件。
然后,对于FullCalendar React组件文档,您可以在此处参考。
为了将FullCalendar与Next.js整合在一起,我写了一篇有关如何在Next.js中使用Fullcalendar的文章。您可能想阅读有关它的信息。
我希望这会有所帮助。