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

Vue3中如何使用fullcalendar日歷插件

 更新時間:2024年01月17日 11:41:36   作者:stephen?Curry_  
這篇文章主要介紹了Vue3中如何使用fullcalendar日歷插件,本文給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友參考下吧
npm install @fullcalendar/core
npm install @fullcalendar/vue3
vue文件中引用
import FullCalendar from "@fullcalendar/vue3"
必須安裝一個:
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", // 默認為那個視圖(月:dayGridMonth,周:timeGridWeek,日:timeGridDay)
      headerToolbar: {
        left: "prev",
        center: "title",
        right: "today,next",
      },
      locale: "zh-cn", // 切換語言,當前為中文
      eventColor: "#ffffff", // 全部日歷日程背景色
      initialDate: proxy.$dayjs().format("YYYY-MM-DD"), // 自定義設(shè)置背景顏色時一定要初始化日期時間
      allDaySlot: false,
      height: "422px",
      buttonText: {
        today: "當前月",
        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)
      },
      // 強調(diào)日歷上的特定時間段。默認為周一至周五,上午9點至下午5點。
      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)
      },
      // 限制用戶選擇特定的時間窗口。
      // 事件
      // eventClick: eventClick, // 點擊日歷日程事件
      // eventDrop: eventDrop, // 拖動日歷日程事件
      // eventResize: eventResize, // 修改日歷日程大小事件
      // select: handleDateSelect, // 選中日歷格事件
      // eventDidMount: this.eventDidMount, // 安裝提示事件
      // loading: loading, // 視圖數(shù)據(jù)加載中、加載完成觸發(fā)(用于配合顯示/隱藏加載指示器。)
      // selectAllow: selectAllow, //編程控制用戶可以選擇的地方,返回true則表示可選擇,false表示不可選擇
      // eventMouseEnter: eventMouseEnter, // 鼠標滑過
      editable: true, // 是否可以進行(拖動、縮放)修改
      eventStartEditable: true, // Event日程開始時間可以改變,默認true,如果是false其實就是指日程塊不能隨意拖動,只能上下拉伸改變他的endTime
      eventDurationEditable: true, // Event日程的開始結(jié)束時間距離是否可以改變,默認true,如果是false則表示開始結(jié)束時間范圍不能拉伸,只能拖拽
      selectable: true, // 是否可以選中日歷格
      selectMinDistance: 0, // 選中日歷格的最小距離
      dayMaxEvents: true,
      weekends: true, // 是否在任何日歷視圖中包括周六/周日列。
      navLinks: false, // 確定日名和周名是否可單擊
      schedulerLicenseKey: "GPL-My-Project-Is-Open-Source", // 此配置是為了消除右下角的版權(quán)提示
      slotEventOverlap: false, // 相同時間段的多個日程視覺上是否允許重疊,默認true允許
      resourceAreaColumns: [
        {
          headerContent: "車型",
          field: "room_name",
        },
        {
          headerContent: "車牌",
          field: "car_code",
        },
      ],
      resourceAreaWidth: "15%",
      resources: resourcesData.value,  // 后臺給 渲染的數(shù)據(jù)
      events: matchList.value,// 后臺給 渲染的數(shù)據(jù)
    };
})
數(shù)據(jù)格式(根據(jù)實際情況來,均為后臺返回):
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 +
        " 用車時間:" +
        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)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論

龙口市| 哈密市| 孝义市| 三穗县| 绥棱县| 清河县| 建平县| 迁安市| 文水县| 通道| 尼玛县| 资源县| 隆回县| 枞阳县| 苍南县| 武安市| 丹巴县| 资溪县| 塘沽区| 申扎县| 景德镇市| 塔河县| 哈密市| 江北区| 巫山县| 绍兴县| 威远县| 新闻| 沾化县| 湘西| 秭归县| 宝鸡市| 东丰县| 高要市| 高陵县| 阿拉善盟| 凤凰县| 清涧县| 双江| 方正县| 桐乡市|