我最近进入了nextjs并且我想使用Full-calendar进行反应,并且它不起作用,它继续说我没有定义fullCalendar。我认为原因是因为它是从服务器呈现的,并且jquery无法识别,有什么方法可以做到这一点吗?
Cannot set property 'fullCalendar' of undefined
TypeError: Cannot set property 'fullCalendar' of undefined
at Object.<anonymous> (C:\Users\jarka\OneDrive\Desktop\hr-website\hr-next-graphql\next\node_modules\fullcalendar-reactwrapper\lib\index.js:26051:19)
at $.fullCalendar.version (C:\Users\jarka\OneDrive\Desktop\hr-website\hr-next-graphql\next\node_modules\fullcalendar-reactwrapper\lib\index.js:26028:37)
at Object.map../af (C:\Users\jarka\OneDrive\Desktop\hr-website\hr-next-graphql\next\node_modules\fullcalendar-reactwrapper\lib\index.js:26037:3)
at __webpack_require__ (C:\Users\jarka\OneDrive\Desktop\hr-website\hr-next-graphql\next\node_modules\fullcalendar-reactwrapper\lib\index.js:30:30)
at Object.defineProperty.value (C:\Users\jarka\OneDrive\Desktop\hr-website\hr-next-graphql\next\node_modules\fullcalendar-reactwrapper\lib\index.js:25910:21)
at __webpack_require__ (C:\Users\jarka\OneDrive\Desktop\hr-website\hr-next-graphql\next\node_modules\fullcalendar-reactwrapper\lib\index.js:30:30)
at Object.<anonymous> (C:\Users\jarka\OneDrive\Desktop\hr-website\hr-next-graphql\next\node_modules\fullcalendar-reactwrapper\lib\index.js:41903:18)
at __webpack_require__ (C:\Users\jarka\OneDrive\Desktop\hr-website\hr-next-graphql\next\node_modules\fullcalendar-reactwrapper\lib\index.js:30:30)
at C:\Users\jarka\OneDrive\Desktop\hr-website\hr-next-graphql\next\node_modules\fullcalendar-reactwrapper\lib\index.js:76:18
at C:\Users\jarka\OneDrive\Desktop\hr-website\hr-next-graphql\next\node_modules\fullcalendar-reactwrapper\lib\index.js:79:10
at webpackUniversalModuleDefinition (C:\Users\jarka\OneDrive\Desktop\hr-website\hr-next-graphql\next\node_modules\fullcalendar-reactwrapper\lib\index.js:3:20)
at Object.<anonymous> (C:\Users\jarka\OneDrive\Desktop\hr-website\hr-next-graphql\next\node_modules\fullcalendar-reactwrapper\lib\index.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集成。它还有一个最近发布的official FullCalendar React component。
然后,对于FullCalendar React组件文档,您可以参考here。
为了将FullCalendar与Next.js集成,我写了一篇关于how to use FullCalendar in Next.js的文章。您可能想要了解它。
我希望这有帮助。