avatar

mdo

Hello

  • 首页
  • 知识库
  • 归档
  • 标签
  • 关于
主页 FullCalendar-日程表vue使用
文章

FullCalendar-日程表vue使用

发表于 2025-09-24 更新于 2025-09- 24
作者 mdo
14~18 分钟 阅读

Fullcalendar是一个非常受欢迎的日历日程处理的js组件,它功能强大,文档齐全,可定制化高,可与你的项目无缝对接。本站之前有很多文章介绍了Fullcalendar(v5)的使用。今天我们来看看如何在Vue框架下使用Fullcalendar。

  • FullCalendar官网:fullcalendar.io/
  • FullCalendar官方文档:fullcalendar.io/docs

最新FullCalendar中文文档合集 大家可以参考这个网站的总结,挺到位 最新FullCalendar中文文档

先看效果图

安装Fullcalendar

npm install --save @fullcalendar/vue @fullcalendar/core @fullcalendar/daygrid @fullcalendar/interaction @fullcalendar/timegrid

FullCalendar 以核心代码和插件形式提供给用户安装,因此我们需要哪些功能,就直接安装对应的插件即可。使用时可以参照:功能插件列表。

使用

1. 建立一个Fullcalendar.vue
<template>

  <div class="top" style="background: #fff; padding: 8px 6px">
    <div class="modelBox">
      <span class="radis"></span>
      <span style="color: black; font-size: 16px; font-weight: bold">待办任务</span>
    </div>
    <div class="tabs" style="width: 100%">
      <FullCalendar ref="fullCalendar" :options="calendarOptions" class="demo-app-calendar" />
    </div>
  </div>
</template>
2. 引入所要用的插件
import FullCalendar from '@fullcalendar/vue'
import dayGridPlugin from '@fullcalendar/daygrid'
import timeGridPlugin from '@fullcalendar/timegrid'
import interactionPlugin from '@fullcalendar/interaction'
import zhCnLocale from '@fullcalendar/core/locales/zh-cn'
3. 所有的配置项在calendarOptions完成
calendarOptions: {
        plugins: [

          dayGridPlugin,
          timeGridPlugin,
          interactionPlugin, 
        ],
        height: 800, 
        width: 600,
        headerToolbar: {

          left: 'prev,next today',
          center: 'title',
          right: 'timeGridDay,timeGridWeek,dayGridMonth',

        },
        handleWindowResize: true, 
        initialView: 'dayGridMonth', 





        selectable: true,

        dayMaxEvents: true,



        eventMouseEnter: this.handleEventMouseEnter, 


        eventClick: this.handleEventClick, 
        locale: zhCnLocale,
        nextDayThreshold: '01:00:00',
        events: [







        ],


        eventAdd:
        eventChange:
        eventRemove:
        */
},
4. 日程表赋值
that.calendarOptions.events.push({
   color: '#ff9900', 
   title: element.name,
   date: element.time,
   status: this.statusName,
   type: element.type,
   times: element.time,
   category: element.category
})
5. 本案例用到在日程上鼠标移入悬浮框显示详情,利用eventMouseEnter鼠标悬停事件,这里用到tippy.js插件,tippy.js文档。
handleEventMouseEnter(info) {
      console.log(info, 'yyyy')
      let col = info.event.borderColor
      let eve = info.event._def.extendedProps
      let category = info.event._def.extendedProps.category

      tippy(info.el, {






        content: `<div style='width: 260px;background-color:#FAFAFA;padding:5px;font-size:14px;z-index:99999;'>
                  <div style='display:flex;color: #666666;overflow: hidden;' class="${ eve.category == 1 ? 'hidden' : ''}">
                    <div><span style='display:inline-block;width:6px;height:6px;background-color:#318DDE;border-radius:50%;margin:0 5px;'></span>会议名称: </div>
                    <div style="width:161px;white-space:normal;overflow: auto;table-layout:fixed; word-break: break-all; height:auto;display:inner-block">${info.event.title}</div>
                  </div>
                  <div style='color: #666666;overflow: hidden;' class="${ eve.category == 1 ? 'hidden' : ''}"><span style='display:inline-block;width:6px;height:6px;background-color:#318DDE;border-radius:50%;margin:0 5px;'></span>会议类型:${eve.type}</div>
                  <div style='color: #666666;overflow: hidden;' class="${ eve.category == 1 ? 'hidden' : ''}"><span style='display:inline-block;width:6px;height:6px;background-color:#318DDE;border-radius:50%;margin:0 5px;'></span>会议时间:${eve.times}</div>
                  <div style='color: #666666;overflow: hidden;' class="${ eve.category == 1 ? 'hidden' : ''}"><span style='display:inline-block;width:6px;height:6px;background-color:#318DDE;border-radius:50%;margin:0 5px;'></span>会议状态:${eve.status}</div>
                  <div style='color: #666666;overflow: hidden;' class="${ eve.category == 0 ? 'hidden' : ''}"><span style='display:inline-block;width:6px;height:6px;background-color:#318DDE;border-radius:50%;margin:0 5px;'></span>年份:${eve.year}</div>
                  <div style='color: #666666;overflow: hidden;' class="${ eve.category == 0 ? 'hidden' : ''}"><span style='display:inline-block;width:6px;height:6px;background-color:#318DDE;border-radius:50%;margin:0 5px;'></span>领域角色:${eve.depRoleName}</div>
                  <div style='color: #666666;overflow: hidden;' class="${ eve.category == 0 ? 'hidden' : ''}"><span style='display:inline-block;width:6px;height:6px;background-color:#318DDE;border-radius:50%;margin:0 5px;'></span>姓名:${eve.name}</div>
                </div>`,
        theme: 'light', 

        interactive: true, 
        placement: 'top-start', 
        allowHTML: true, 
        zIndex: 99999,
      })
    },
技术
日程表
许可协议:  CC BY 4.0
分享

相关文章

7月 26, 2026

完美地解决 TP3 老系统数据的平滑读取

为了彻底、完美地解决 TP3 老系统数据的平滑读取,必须解决两个核心痛点: TP3 的盲猜反序列化机制(标量存原样,数组/对象存原生 serialize,同时兼容 json)。 TP3 与 TP6 的缓存前缀(Prefix)不一致。 以下是为你量身定制的终极落地解决方案,通

7月 26, 2026

thinkphp3 redis序列化和反序列化

在老系统重构迁移至 ThinkPHP 6 (TP6) 的过程中,ThinkPHP 3 (TP3) 的 Redis 序列化历史遗留问题是最核心的连环坑之一。 TP3 的 S('key', $value) 缓存方法和底层 Redis 驱动,在存储非字符串(如数组、对象)时,有一套独特的序列化行为。如果不

7月 24, 2026

Table 空间极易发生哈希冲突并溢出

既然你没有在业务中主动调用 Room,只使用了全局广播,那么这个问题就非常明确了:即使你不用房间功能,think-swoole 只要开启了 WebSocket,底层就会强行初始化并注入一个名为 Room 的驱动组件。 [1] 框架底层默认使用 table 类型来作为 Room 的存储介质。当进行全局

下一篇

前端如何做K线图

上一篇

php 命令行查看配置文件

最近更新

  • 完美地解决 TP3 老系统数据的平滑读取
  • thinkphp3 redis序列化和反序列化
  • Table 空间极易发生哈希冲突并溢出
  • 将监控程序直接跑在云端
  • AI 驱动型 Facebook 群组关键词监控 Chrome 浏览器插件

热门标签

API CodeGeex Gitkraken Management Manticore Premiere Sublime Swoole ThinkPHP ThinkPHP5

目录

©2026 mdo. 保留部分权利。