【问题标题】:Displaying only 3 day of a week view of fullcalendar in React在 React 中仅显示一周中 3 天的完整日历视图
【发布时间】:2021-08-05 06:46:30
【问题描述】:

我在我的项目中将 FullCalendar.io React 组件用于所有日历用例。有没有办法只显示 3 天而不是一周中的所有天?我尝试过使用 views 属性,但它没有用。

<FullCalendar 
           plugins={[ dayGridPlugin, interactionPlugin , timeGridPlugin]}
           views = {{
            agendaThreeDay: {
                type: 'agenda',
                duration: { days: 3 },
                buttonText: '3 day'
            }
            }}
           selectable
           initialView = {agendaThreeDay}
       />
    

【问题讨论】:

  • 你能通过duration= { days: 4 } 并检查吗?作为另一个道具
  • "agenda" 不是视图类型...尝试type: "timeGrid"
  • @Amruth 为什么要设置 4 天的持续时间来获得 3 天的视图?这根本没有意义。
  • @ADyson 糟糕。我从文档中复制了它的duration= { days: 3 }
  • @Amruth 你是想说 OP 应该使用 React 插件语法来声明这个选项吗?你可能是对的,但它不仅仅需要改变一个:to =.

标签: javascript reactjs fullcalendar fullcalendar-5


【解决方案1】:

通过更改 agendaThreeDay 视图在初始视图中的使用方式解决了该问题。

<FullCalendar 
       plugins={[ dayGridPlugin, interactionPlugin , timeGridPlugin]}
       views = {{
        agendaThreeDay: {
            type: 'agenda',
            duration: { days: 3 },
            buttonText: '3 day'
        }
        }}
       selectable
       initialView = 'agendaThreeDay'
   />

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-08-26
    相关资源
    最近更新 更多