亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

完整日歷中的自定義按鈕不顯示

完整日歷中的自定義按鈕不顯示

撒科打諢 2023-10-14 11:16:53
我在 FullCalendar 中遇到問題,我剛剛添加了customButtons這樣的內容: customButtons: {    AddEvent: {    text: 'Add Event',    click: function () {     //Show Modal    }  }},但按鈕不顯示。我還檢查了窗口中的元素,但它丟失了。這是我的整個 JavaScript 代碼。 <script>        document.addEventListener('DOMContentLoaded', function () {            var calendarEl = document.getElementById('calendar');            var calendar;            var date = new Date;            initThemeChooser({                init: function (themeSystem) {                    calendar = new FullCalendar.Calendar(calendarEl, {                        schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source',                        themeSystem: themeSystem,                        now: date,                        editable: true, // enable draggable events                        selectable: true,                        nowIndicator: true,                        aspectRatio: 1.8,                        scrollTime: '00:00', // undo default 6am scrollTime                        headerToolbar: {                            left: 'today prev,next',                            center: 'title',                            right: 'resourceTimelineDay,resourceTimelineThreeDays,timeGridWeek,dayGridMonth,listWeek'                        },                        customButtons: {                            AddEvent: {                                text: 'Add Event',                                click: function () {                                   // alert('Show Modal!');                                }                            }                        },                        initialView: 'dayGridMonth',                        views: {                            resourceTimelineThreeDays: {                                type: 'resourceTimeline',                                duration: { days: 3 },                                buttonText: '3 days'                            }                        },如何在完整日歷上添加自定義按鈕?
查看完整描述

1 回答

?
天涯盡頭無女友

TA貢獻1831條經驗 獲得超9個贊

您創建了該按鈕,但必須將其添加到標題菜單中的某個位置。目前 fullCalendar 不知道你想在哪里顯示它。

文檔中有一個示例:https://fullcalendar.io/docs/customButtons

var calendar = new Calendar(calendarEl, {

  customButtons: {

    myCustomButton: {

      text: 'custom!',

      click: function() {

        alert('clicked the custom button!');

      }

    }

  },

  headerToolbar: {

    left: 'prev,next today myCustomButton',

    center: 'title',

    right: 'dayGridMonth,timeGridWeek,timeGridDay'

  }

});


查看完整回答
反對 回復 2023-10-14
  • 1 回答
  • 0 關注
  • 172 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號