Javascript 我找不到将fullcalendar io与json数组一起使用的方法

Javascript 我找不到将fullcalendar io与json数组一起使用的方法,javascript,arrays,json,fullcalendar,Javascript,Arrays,Json,Fullcalendar,如果有人帮我学习javascript,我会很高兴。我的代码可以用这种方式显示数据。但是我需要用数组来显示它,我不能。谢谢你的帮助!!:)这是我的jquery代码: jQuery(document).ready(function () { _user = JSON.parse('@Html.Raw(Json.Serialize(Model.User))'); KTCalendarBasic.init(); user_appointments_list

如果有人帮我学习javascript,我会很高兴。我的代码可以用这种方式显示数据。但是我需要用数组来显示它,我不能。谢谢你的帮助!!:)这是我的jquery代码:

jQuery(document).ready(function () {
        _user = JSON.parse('@Html.Raw(Json.Serialize(Model.User))');
        KTCalendarBasic.init();
        user_appointments_list = _user.user_appointments;
        for (var i = 0; i < user_appointments_list.length; i++) {
            user_appointment_date_list[i] = user_appointments_list[i].appointment_time;
        }
    });
jQuery(文档).ready(函数(){
_user=JSON.parse('@Html.Raw(JSON.Serialize(Model.user)));
KTCalendarBasic.init();
用户预约列表=\u user.user\u预约;
对于(变量i=0;i
这是我的完整日历用法。它适用于一个json数据对象

var KTCalendarBasic = function () {
        return {
        init: function () {
                events:
                    [
                    {
                        title: 'Hatırlatıcı',
                        start: _user.user_reminders[0].remind_date,
                        end: _user.user_reminders[0].remind_date,
                        description: "NOT: " + _user.user_reminders[0].note + " GAYRİMENKUL ADRESİ: " + _user.user_reminders[0].asset_address + " MÜŞTERİ: " + _user.user_reminders[0].customer_full_name + " MÜŞTERİ TELEFONU: " + _user.user_reminders[0].customer_phone,
                        className: "fc-event-danger fc-event-solid-warning"

                    },
                    {

                        title: 'Randevu',
                        //start: YM + '-14T13:30:00',
                        start: _user.user_appointments[0].appointment_time,
                        description: "ADRES: " + _user.user_appointments[0].appointment_place + " MÜŞTERİ: " + _user.user_appointments[0].customer_full_name,
                        //description: _user.user_appointments.appointment_time,
                        end: _user.user_appointments[0].appointment_time,
                        className: "fc-event-success",
                    }
                    ],
                eventRender: function (info) {
                    var element = $(info.el);

                    if (info.event.extendedProps && info.event.extendedProps.description) {
                        if (element.hasClass('fc-day-grid-event')) {
                            element.data('content', info.event.extendedProps.description);
                            element.data('placement', 'top');
                            KTApp.initPopover(element);
                        } else if (element.hasClass('fc-time-grid-event')) {
                            element.find('.fc-title').append('<div class="fc-description">' + info.event.extendedProps.description + '</div>');
                        } else if (element.find('.fc-list-item-title').lenght !== 0) {
                            element.find('.fc-list-item-title').append('<div class="fc-description">' + info.event.extendedProps.description + '</div>');
                        }
                    }
                }
            });

            calendar.render();
        }
    };
}();
    
var KTCalendarBasic=函数(){
返回{
init:函数(){
活动:
[
{
标题:“Hatırlatıcı”,
开始:\用户。用户提醒[0]。提醒日期,
结束:\用户。用户提醒[0]。提醒日期,
描述:“非:”+”用户。用户提醒[0]。注意+”加伊尔·门库尔地址:“+”用户。用户提醒[0]。资产地址+”MÜ350; TERİ:”+”用户。用户提醒[0]。客户全名+“MÜ350; TERİTELEFONU:”+”用户。用户提醒[0]。客户电话,
类名:“fc事件危险fc事件固体警告”
},
{
标题:“Randevu”,
//开始时间:YM+'-14T13:30:00',
开始:\用户。用户\约会[0]。约会时间,
description:“地址:”+\u user.user\u约会[0]。约会地点+“MÜ350İTERİ:”+\u user.user\u约会[0]。客户全名,
//描述:_user.user_约会.约会时间,
结束:\用户。用户\预约[0]。预约时间,
类名:“fc事件成功”,
}
],
eventRender:函数(信息){
var元素=$(info.el);
if(info.event.extendedProps&&info.event.extendedProps.description){
if(element.hasClass('fc-day-grid-event')){
元素.data('content',info.event.extendedProps.description);
元素数据('placement','top');
KTApp.initPopover(元素);
}else if(element.hasClass('fc-time-grid-event')){
元素.find('.fc title').append(''+info.event.extendedProps.description+'');
}else if(element.find('.fc列表项标题').lenght!==0){
元素.find('.fc列表项标题').append(''+info.event.extendedProps.description+'');
}
}
}
});
calendar.render();
}
};
}();
我必须用我编写的数组修复它,它在jquery部分正确地转换。我必须在fullcalendar使用部分中实现这个数组。谢谢!:))

init:function(){
对于(var j=0;j
我尝试了这段代码。并重写了事件部分。最终的完整代码是:

var KTCalendarBasic = function () {

            return {
                //main function to initiate the module
                init: function () {
                    for (var j = 0; j < user_appointment_date_list.length; j++) {
                        var currentValue = user_appointment_date_list[j];
                        var todayDate = moment().startOf('day');
                        var YM = todayDate.format('YYYY-MM');
                        var YESTERDAY = todayDate.clone().subtract(1, 'day').format('YYYY-MM-DD');
                        var TODAY = todayDate.format('YYYY-MM-DD');
                        var TOMORROW = todayDate.clone().add(1, 'day').format('YYYY-MM-DD');

                        var calendarEl = document.getElementById('kt_calendar');
                        var calendar = new FullCalendar.Calendar(calendarEl, {

                            plugins: ['bootstrap', 'interaction', 'dayGrid', 'timeGrid', 'list'],
                            themeSystem: 'bootstrap',

                            isRTL: KTUtil.isRTL(),

                            header: {
                                left: 'prev,next today',
                                center: 'title',
                                right: 'dayGridMonth,timeGridWeek,timeGridDay'
                            },

                            height: 800,
                            contentHeight: 780,
                            aspectRatio: 3,  // see: https://fullcalendar.io/docs/aspectRatio

                            nowIndicator: true,
                            //now: TODAY + 'T09:25:00', // just for demo

                            views: {
                                dayGridMonth: { buttonText: 'month' },
                                timeGridWeek: { buttonText: 'week' },
                                timeGridDay: { buttonText: 'day' }
                            },

                            defaultView: 'dayGridMonth',
                            defaultDate: TODAY,

                            editable: false,
                            eventLimit: true, // allow "more" link when too many events
                            navLinks: true,
                            events:
                                [
                                    {
                                      
                                        title: 'Hatırlatıcı',
                                        //start: user_appointment_date_list,
                                        //start: item.remind_date,
                                        //end: item.remind_date,
                                        //description: "NOT: " + item.note + " GAYRİMENKUL ADRESİ: " + item.asset_address + " MÜŞTERİ: " + item.customer_full_name + " MÜŞTERİ TELEFONU: " + item.customer_phone,
                                        className: "fc-event-danger fc-event-solid-warning",
                                        startRecur: currentValue,
                                        endRecur: currentValue


                                    },
                                    {

                                        title: 'Randevu',
                                        //start: YM + '-14T13:30:00',
                                        start: _user.user_appointments[0].appointment_time,
                                        description: "ADRES: " + _user.user_appointments[0].appointment_place + " MÜŞTERİ: " + _user.user_appointments[0].customer_full_name,
                                        //description: _user.user_appointments.appointment_time,
                                        end: _user.user_appointments[0].appointment_time,
                                        className: "fc-event-success",
                                    }
                                ],
                            eventRender: function (info) {
                                var element = $(info.el);

                                if (info.event.extendedProps && info.event.extendedProps.description) {
                                    if (element.hasClass('fc-day-grid-event')) {
                                        element.data('content', info.event.extendedProps.description);
                                        element.data('placement', 'top');
                                        KTApp.initPopover(element);
                                    } else if (element.hasClass('fc-time-grid-event')) {
                                        element.find('.fc-title').append('<div class="fc-description">' + info.event.extendedProps.description + '</div>');
                                    } else if (element.find('.fc-list-item-title').lenght !== 0) {
                                        element.find('.fc-list-item-title').append('<div class="fc-description">' + info.event.extendedProps.description + '</div>');
                                    }
                                }
                            }
                        });
                        calendar.render();
                    }
                }
            };
        }();
var KTCalendarBasic=函数(){
返回{
//启动模块的主要功能
init:函数(){
对于(var j=0;jvar KTCalendarBasic = function () {

            return {
                //main function to initiate the module
                init: function () {
                    for (var j = 0; j < user_appointment_date_list.length; j++) {
                        var currentValue = user_appointment_date_list[j];
                        var todayDate = moment().startOf('day');
                        var YM = todayDate.format('YYYY-MM');
                        var YESTERDAY = todayDate.clone().subtract(1, 'day').format('YYYY-MM-DD');
                        var TODAY = todayDate.format('YYYY-MM-DD');
                        var TOMORROW = todayDate.clone().add(1, 'day').format('YYYY-MM-DD');

                        var calendarEl = document.getElementById('kt_calendar');
                        var calendar = new FullCalendar.Calendar(calendarEl, {

                            plugins: ['bootstrap', 'interaction', 'dayGrid', 'timeGrid', 'list'],
                            themeSystem: 'bootstrap',

                            isRTL: KTUtil.isRTL(),

                            header: {
                                left: 'prev,next today',
                                center: 'title',
                                right: 'dayGridMonth,timeGridWeek,timeGridDay'
                            },

                            height: 800,
                            contentHeight: 780,
                            aspectRatio: 3,  // see: https://fullcalendar.io/docs/aspectRatio

                            nowIndicator: true,
                            //now: TODAY + 'T09:25:00', // just for demo

                            views: {
                                dayGridMonth: { buttonText: 'month' },
                                timeGridWeek: { buttonText: 'week' },
                                timeGridDay: { buttonText: 'day' }
                            },

                            defaultView: 'dayGridMonth',
                            defaultDate: TODAY,

                            editable: false,
                            eventLimit: true, // allow "more" link when too many events
                            navLinks: true,
                            events:
                                [
                                    {
                                      
                                        title: 'Hatırlatıcı',
                                        //start: user_appointment_date_list,
                                        //start: item.remind_date,
                                        //end: item.remind_date,
                                        //description: "NOT: " + item.note + " GAYRİMENKUL ADRESİ: " + item.asset_address + " MÜŞTERİ: " + item.customer_full_name + " MÜŞTERİ TELEFONU: " + item.customer_phone,
                                        className: "fc-event-danger fc-event-solid-warning",
                                        startRecur: currentValue,
                                        endRecur: currentValue


                                    },
                                    {

                                        title: 'Randevu',
                                        //start: YM + '-14T13:30:00',
                                        start: _user.user_appointments[0].appointment_time,
                                        description: "ADRES: " + _user.user_appointments[0].appointment_place + " MÜŞTERİ: " + _user.user_appointments[0].customer_full_name,
                                        //description: _user.user_appointments.appointment_time,
                                        end: _user.user_appointments[0].appointment_time,
                                        className: "fc-event-success",
                                    }
                                ],
                            eventRender: function (info) {
                                var element = $(info.el);

                                if (info.event.extendedProps && info.event.extendedProps.description) {
                                    if (element.hasClass('fc-day-grid-event')) {
                                        element.data('content', info.event.extendedProps.description);
                                        element.data('placement', 'top');
                                        KTApp.initPopover(element);
                                    } else if (element.hasClass('fc-time-grid-event')) {
                                        element.find('.fc-title').append('<div class="fc-description">' + info.event.extendedProps.description + '</div>');
                                    } else if (element.find('.fc-list-item-title').lenght !== 0) {
                                        element.find('.fc-list-item-title').append('<div class="fc-description">' + info.event.extendedProps.description + '</div>');
                                    }
                                }
                            }
                        });
                        calendar.render();
                    }
                }
            };
        }();