Fullcalendar全日历 vue2.0的使用方法

1.安装插件

	"@fullcalendar/core": "^5.9.0",
   "@fullcalendar/daygrid": "^5.9.0",
   "@fullcalendar/interaction": "^5.9.0",
   "@fullcalendar/timegrid": "^5.9.0",
   "@fullcalendar/vue": "^5.9.0",

2.在页面内引入插件

<template>
      <div>
         <FullCalendar ref="calendarEl" :options="calendarOptions" />
      </div>
   </template>
   <script>
      import '@fullcalendar/core/vdom' // solves problem with Vite
      import FullCalendar from '@fullcalendar/vue'
      import dayGridPlugin from '@fullcalendar/daygrid'
      import timeGridPlugin from '@fullcalendar/timegrid'
      import interactionPlugin from '@fullcalendar/interaction'

      export default {
         注册组件
         components: {
            FullCalendar, // make the <FullCalendar> tag available
         },
         data () {
            rturn {
               calendarOptions: {
                  plugins: [dayGridPlugin, interactionPlugin, timeGridPlugin],
                  headerToolbar: {
                     left: 'prev,next today',
                     center: 'title',
                     right: 'dayGridMonth,timeGridWeek,timeGridDay'
                  },
                  buttonText: { //各按钮的显示文本信息
                     today: '今天',
                     month: '月',
                     week: '周',
                     day: '日',
                  },
                  locale: 'zh-cn', //语言环境
                  initialView: 'timeGridWeek',
                  // initialEvents: [], // alternatively, use the `events` setting to fetch from a feed
                  events: [{//日程事件
                     id: createEventId(),
                     title: '会议',
                     start: '2021-09-17 08:15',
                     end: '2021-09-17 11:30'
                  },
                  {
                     id: createEventId(),
                     title: '会议1',
                     start: '2021-09-18 10:15',
                     end: '2021-09-18 11:30'
                  }],
                  editable: true,
                  selectable: true,
                  selectMirror: true,
                  dayMaxEvents: true,
                  weekends: true,
                  eventDurationEditable: true,
                  select: this.handleDateSelect,//拖拽选中事件
                  eventClick: this.handleEventClick,//日程事件点击事件
                  eventsSet: this.handleEvents,//设置日程事件
                  eventDrop: (info) => {
                     console.log(info);
                  },
                  eventResize: (info) => {
                     console.log(info, '<<<<<调整日程');
                  },
                  slotDuration: '00:15:00', // 15 minates
                  height: '100%'
               },
            }
         }
      }
   </script>
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值