最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Vue3中如何使用fullcalendar日歷插件

 更新時(shí)間:2024年01月17日 11:41:36   作者:stephen?Curry_  
這篇文章主要介紹了Vue3中如何使用fullcalendar日歷插件,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友參考下吧
npm install @fullcalendar/core
npm install @fullcalendar/vue3
vue文件中引用
import FullCalendar from "@fullcalendar/vue3"
必須安裝一個(gè):
npm install @fullcalendar/daygrid
npm install @fullcalendar/multimonth
npm install @fullcalendar/timegrid

在vue文件中的template中     

<FullCalendar
            v-if="calendarOptions"
            style="margin-top: 30px"
            class="calenderCon"
            ref="fullCalendar"
            :options="calendarOptions"
          >
</FullCalendar>
import resourceTimelinePlugin from "@fullcalendar/resource-timeline";// 引入需要的視圖
    let calendarOptions = ref();
// 使用resourceTimelineMonth需安裝
onMounted(() => {
    calendarOptions.value = {
      plugins: [dayGridPlugin, timeGridPlugin, resourceTimelinePlugin],
      initialView: "resourceTimelineMonth", // 默認(rèn)為那個(gè)視圖(月:dayGridMonth,周:timeGridWeek,日:timeGridDay)
      headerToolbar: {
        left: "prev",
        center: "title",
        right: "today,next",
      },
      locale: "zh-cn", // 切換語言,當(dāng)前為中文
      eventColor: "#ffffff", // 全部日歷日程背景色
      initialDate: proxy.$dayjs().format("YYYY-MM-DD"), // 自定義設(shè)置背景顏色時(shí)一定要初始化日期時(shí)間
      allDaySlot: false,
      height: "422px",
      buttonText: {
        today: "當(dāng)前月",
        day: "日",
      },
      // 日程
      businessHours: {
        daysOfWeek: [1, 2, 3, 4], // Monday - Thursday
        startTime: "10:00", // a start time (10am in this example)
        endTime: "18:00", // an end time (6pm in this example)
      },
      // 強(qiáng)調(diào)日歷上的特定時(shí)間段。默認(rèn)為周一至周五,上午9點(diǎn)至下午5點(diǎn)。
      selectConstraint: {
        daysOfWeek: [1, 2, 3, 4], // Monday - Thursday
        startTime: "10:00", // a start time (10am in this example)
        endTime: "18:00", // an end time (6pm in this example)
      },
      // 限制用戶選擇特定的時(shí)間窗口。
      // 事件
      // eventClick: eventClick, // 點(diǎn)擊日歷日程事件
      // eventDrop: eventDrop, // 拖動(dòng)日歷日程事件
      // eventResize: eventResize, // 修改日歷日程大小事件
      // select: handleDateSelect, // 選中日歷格事件
      // eventDidMount: this.eventDidMount, // 安裝提示事件
      // loading: loading, // 視圖數(shù)據(jù)加載中、加載完成觸發(fā)(用于配合顯示/隱藏加載指示器。)
      // selectAllow: selectAllow, //編程控制用戶可以選擇的地方,返回true則表示可選擇,false表示不可選擇
      // eventMouseEnter: eventMouseEnter, // 鼠標(biāo)滑過
      editable: true, // 是否可以進(jìn)行(拖動(dòng)、縮放)修改
      eventStartEditable: true, // Event日程開始時(shí)間可以改變,默認(rèn)true,如果是false其實(shí)就是指日程塊不能隨意拖動(dòng),只能上下拉伸改變他的endTime
      eventDurationEditable: true, // Event日程的開始結(jié)束時(shí)間距離是否可以改變,默認(rèn)true,如果是false則表示開始結(jié)束時(shí)間范圍不能拉伸,只能拖拽
      selectable: true, // 是否可以選中日歷格
      selectMinDistance: 0, // 選中日歷格的最小距離
      dayMaxEvents: true,
      weekends: true, // 是否在任何日歷視圖中包括周六/周日列。
      navLinks: false, // 確定日名和周名是否可單擊
      schedulerLicenseKey: "GPL-My-Project-Is-Open-Source", // 此配置是為了消除右下角的版權(quán)提示
      slotEventOverlap: false, // 相同時(shí)間段的多個(gè)日程視覺上是否允許重疊,默認(rèn)true允許
      resourceAreaColumns: [
        {
          headerContent: "車型",
          field: "room_name",
        },
        {
          headerContent: "車牌",
          field: "car_code",
        },
      ],
      resourceAreaWidth: "15%",
      resources: resourcesData.value,  // 后臺(tái)給 渲染的數(shù)據(jù)
      events: matchList.value,// 后臺(tái)給 渲染的數(shù)據(jù)
    };
})
數(shù)據(jù)格式(根據(jù)實(shí)際情況來,均為后臺(tái)返回):
resourcesData.value  
    {
      id: item.id,
      room_name: item.car_type,
      car_code: item.car_code,
    }
matchList.value
{
      id: item.id,
      resourceId: item.id,
      title:
        "用車人:" +
        item.use_person_name +
        " 用車時(shí)間:" +
        item.start_time +
        "~" +
        item.end_time +
        "用途:" +
        item.purpose,
      start: item.start_time,
      end: item.end_time,
      color: "yellow",
      textColor: "black",
    }

 文檔內(nèi)容比較豐富,可以自行去官網(wǎng)查看

 附:官網(wǎng)地址:https://fullcalendar.io/

到此這篇關(guān)于Vue3使用fullcalendar日歷插件的文章就介紹到這了,更多相關(guān)Vue3 fullcalendar日歷插件內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論

钟山县| 永吉县| 米易县| 石嘴山市| 瑞昌市| 南江县| 临颍县| 修水县| 柳河县| 调兵山市| 介休市| 和林格尔县| 怀安县| 西宁市| 乌苏市| 商南县| 阳江市| 虹口区| 鸡泽县| 灵山县| 深州市| 黄大仙区| 噶尔县| 成都市| 清苑县| 保康县| 东乌珠穆沁旗| 五河县| 高碑店市| 镇远县| 阳春市| 都兰县| 始兴县| 桃园县| 广元市| 前郭尔| 修水县| 红安县| 仁布县| 南京市| 大方县|