[英]Error: viewType "resourceTimelineDay" is not available. Please make sure you've loaded all neccessary plugins
import React from 'react'
import FullCalendar from '@fullcalendar/react'
import dayGridPlugin from '@fullcalendar/daygrid'
import timeGridPlugin from '@fullcalendar/timegrid'
import interactionPlugin from '@fullcalendar/interaction'
import resourceTimelinePlugin from '@fullcalendar/resource-common'
import './calendar.scss'
const TempCalendar = () => {
return (
<FullCalendar
schedulerLicenseKey="CC-Attribution-NonCommercial-NoDerivatives"
timeZone="UTC"
plugins={[resourceTimelinePlugin]}
headerToolbar={{
left: 'today, prev,next',
center: 'title',
right:
'resourceTimelineDay, resourceTimelineTenDay, resourceTimelineMonth, resourceTimelineYear',
}}
scrollTime="08:00"
aspectRatio="1.5"
initialView="resourceTimelineDay"
views={{
resourceTimelineFourDays: {
type: 'resourceTimeline',
duration: { days: 4 },
},
resourceTimelineDay: {
buttonText: ':15 slots',
slotDuration: '00:15',
},
resourceTimelineTenDay: {
type: 'resourceTimeline',
duration: { days: 10 },
buttonText: '10 days',
},
}}
events={[
{ title: 'event 1', date: '2021-01-01' },
{ title: 'event 2', date: '2021-01-02' },
]}
editable="true"
selectable
resourceAreaHeaderContent="Rooms"
resources="https://fullcalendar.io/demo-resources.json?with-nesting&with-colors"
/>
)
}
export default TempCalendar
dependencies = [
"@fortawesome/fontawesome-svg-core": "^1.2.30",
"@fortawesome/free-solid-svg-icons": "^5.14.0",
"@fortawesome/react-fontawesome": "^0.1.11",
"@fullcalendar/core": "^5.5.0",
"@fullcalendar/daygrid": "^5.4.0",
"@fullcalendar/interaction": "^5.4.0",
"@fullcalendar/react": "^5.4.0",
"@fullcalendar/resource-common": "^5.5.0",
"@fullcalendar/resource-daygrid": "^5.5.0",
"@fullcalendar/resource-timegrid": "^5.5.0",
"@fullcalendar/resource-timeline": "^5.5.0",
"@fullcalendar/timegrid": "^5.4.0",
"@hunters/group-object": "^1.2.8",
]
Most of this code is from fullCalendar timeline demoes.大部分代码来自 fullCalendar 时间线演示。 here I don't know what is gone wrong with this.Even if i try other views it gives with the same error with their names.
在这里,我不知道这出了什么问题。即使我尝试其他视图,它的名称也会出现相同的错误。 Maybe I'm missing something for these timeline view I looked for answers other places but i didn't find anything.
也许我在这些时间线视图中遗漏了一些东西,我在其他地方寻找答案,但我什么也没找到。 Please help me out.
请帮帮我。
To fix it you need to registerPlugins
inside of your module.要修复它,您需要在模块中
registerPlugins
插件。
You can try use this code:您可以尝试使用以下代码:
import dayGridPlugin from '@fullcalendar/daygrid';
import timeGridPlugin from '@fullcalendar/timegrid';
import listPlugin from '@fullcalendar/list';
import interactionPlugin from '@fullcalendar/interaction';
import momentTimezonePlugin from '@fullcalendar/moment-timezone';
FullCalendarModule.registerPlugins([
dayGridPlugin,
timeGridPlugin,
listPlugin,
interactionPlugin,
momentTimezonePlugin,
...
]);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.