简体   繁体   English

错误:viewType“resourceTimelineDay”不可用。 请确保您已加载所有必要的插件

[英]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.请帮帮我。

Downgrading to v5.4.0 of fullcalendar (including all plugins) solved this for me.降级到 fullcalendar(包括所有插件)的 v5.4.0 为我解决了这个问题。 It's hardly a "fix," but it's an option.这几乎不是“修复”,但它是一种选择。

The underlying problem is the same error seen here .根本问题与此处看到的错误相同。 This error causes it to not load.此错误导致它无法加载。

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.

相关问题 FullCalendar Vue:viewType“timeGridWeek”不可用。 请确保您已加载所有必要的插件 - FullCalendar Vue: viewType "timeGridWeek" is not available. Please make sure you've loaded all neccessary plugins 加载所有内容时发出警报? - Alert when you've loaded all content? 在Node.js命令上,为什么我会收到错误消息“ Windows找不到$。 确保输入正确的名称……” - on Node.js command, Why am I getting error message “windows cannot find $. Make sure you've typed the name correctly…” Firebase 已在全局 scope 中定义。 请确保 Firebase 库仅加载一次 - Firebase is already defined in the global scope. Please make sure Firebase library is only loaded once Nest 无法解析依赖项(RoleRepository、EntitlementService、?)请确保索引 [2] 处的 Object 在 RolesModule 上下文中可用 - Nest can't resolve dependencies (RoleRepository, EntitlementService, ?) Please make sure Object at index [2] is available in the RolesModule context 确保你已经定义了所有需要的变量 - Make sure you have defined all the variables needed Facebook 登录:请确保您的 redirect_uri 与您在 OAuth 对话框中使用的相同 - Facebook login: Please make sure your redirect_uri is identical to the one you used in the OAuth dialog 你如何让 React 等待所有多媒体完全加载? - How do you make React wait for ALL multimedia to be fully loaded? 如何确保网页或android应用中的所有css和js文件都已加载? - How to make sure that all css and js files in web page or android app are loaded? 如何确保在运行函数之前加载了所有资源? - How do I make sure all resources are loaded before running a function?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM