FullCalendar日历、日程组件 @fullcalendar/vue的 defaultView 配置显示两周时间

1,323 阅读1分钟

一、根据 FullCalendar 中的defaultView有如下配置:

  • 'dayGridMonth':显示月份视图,使用方格来显示每一天。
  • 'timeGridWeek':显示每周的日程视图,按小时显示。
  • 'timeGridDay':显示一天的日程视图,按小时显示。
  • 'listWeek':显示一周的日程列表视图。
  • 'dayGridWeek':显示一周的日历视图,使用方格来显示每一天。
  • 'listDay':显示一天的日程列表视图。
  • 'dayGridDay':显示一天的日历视图,使用方格来显示每一小时。
  • 'resourceTimelineWeek':显示一周的资源日程表视图。

二、自定义——设置展示两周的时间表:

例:可以将`defaultView`设置为`'myCustomView'`,然后在`views`选项中进行配置,如下所示:

data() {
    return {
        defaultView: 'myCustomView', // 默认周显示
        views: {
        myCustomView: {
            type: 'timeGridWeek',
                duration: { weeks: 2 }
            }
        }
    }
}
    <template>
        <FullCalendar
            id="FullCalendar"
            :defaultView="config.defaultView"
            :views="config.views"
        />
    </template>

效果图:

image.png