簡體   English   中英

fullcalendar.js 插件上的單擊事件不起作用

[英]Click event on fullcalendar.js plugin not working

我正在嘗試在 VueJS 中顯示日歷。 我需要以下東西:

  • 月視圖
  • 周視圖
  • 單擊單元格時的日視圖
  • 在日歷的每個單元格中顯示數據

我無法使用 Vuetify 插件,因為我已經在使用 Bootstrap,這就是我使用 fullcalendar.js 插件( https://fullcalendar.io/docs/vue )的原因。

然而,組件背后的 API 似乎並沒有正常工作,

<template>
<div>
    <FullCalendar :plugins="calendarPlugins"
                  :weekends="false"
                  @dateClick="handleDateClick"
    />
</div>
</template>

<script>
    import FullCalendar from '@fullcalendar/vue'
    import dayGridPlugin from '@fullcalendar/daygrid'

    export default {
        name: "Calendar",

        components: {
            FullCalendar // make the <FullCalendar> tag available
        },

        data() {
            return {
                calendarPlugins: [ dayGridPlugin ]
            }
        },
        methods: {
            handleDateClick(arg) {
                alert(arg.date)
            }
        }
    }
</script>

<style lang='scss' scoped>
    @import '~@fullcalendar/core/main.css';
    @import '~@fullcalendar/daygrid/main.css';
</style>

當我點擊一個日期時,如果觸發沒有事件,並且控制台中沒有出現任何錯誤..我在這里做錯了什么?

謝謝你的幫助 !

在此處輸入圖片說明

根據 FullCalender文檔

為了觸發此回調,您必須加載交互插件。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM