gpt4 book ai didi

javascript - 如何在 v 4.3.1 中使用 FullCalendar resourcesTimeGridDay?

转载 作者:行者123 更新时间:2023-11-28 03:11:27 26 4
gpt4 key购买 nike

我正在使用 resourcetimegrid 插件,但它仅在我使用 defaultView:'resourceDayGridDay' 时才有效,并且肯定它只显示日期而不显示小时,但是我想使用 resourceTimeGridDay 来查看时间。

此代码适用于 resourceDayGridDay,但不显示时间。

var calendar = new FullCalendar.Calendar(calendarEl, {
schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source',
plugins: ['interaction', 'resourceDayGrid', 'resourceTimeGrid'],
header: {
left: 'prev,next today',
center: 'title',
right: 'resourceDayGridDay'
},
defaultView: 'resourceDayGridDay',
resources: [
{ id: 'a', title: 'Rampa 1' },
{ id: 'b', title: 'Rampa 2', eventColor: 'green' },
{ id: 'c', title: 'Rampa 3', eventColor: 'orange' },
{ id: 'd', title: 'Rampa 4', eventColor: 'red' },
{ id: 'e', title: 'Rampa 5', eventColor: 'red' },
{ id: 'f', title: 'Rampa 6', eventColor: 'red' },
{ id: 'g', title: 'Rampa 7', eventColor: 'red' },
{ id: 'h', title: 'Rampa 8', eventColor: 'red' }
],
events: [
{ id: '1', resourceId: 'b', start: '2020-02-05T02:00:00', end: '2020-02-05T07:00:00', title: 'event 1' },
{ id: '2', resourceId: 'c', start: '2020-02-05T05:00:00', end: '2020-02-05T22:00:00', title: 'event 2' },
{ id: '3', resourceId: 'd', start: '2020-02-05', end: '2020-02-05', title: 'event 3' },
{ id: '4', resourceId: 'a', start: '2020-02-05T03:00:00', end: '2020-02-05T08:00:00', title: 'event 4' },
{ id: '5', resourceId: 'b', start: '2020-02-05T00:30:00', end: '2020-02-05T02:30:00', title: 'event 5' }

],
selectable: true,
editable: true,
nowIndicator: true,
minTime: "06:00:00",
maxTime: "30:00:00",
droppable: true
});

calendar.render();
};

当我将 defaultView 更改为:resourceTimeGridDay 时,它会抛出:

TypeError: Unable to get property 'ResourceDayGrid' of undefined or null referenceat ResourceTimeGridView (http://localhost/App/Scripts/packages/resource-timegrid/main.js:146:17)

var calendar = new FullCalendar.Calendar(calendarEl, {
schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source',
plugins: ['interaction', 'resourceDayGrid', 'resourceTimeGrid'],
header: {
left: 'prev,next today',
center: 'title',
right: 'resourceTimeGridDay'
},
defaultView: 'resourceTimeGridDay',
resources: [
{ id: 'a', title: 'Room 1' },
{ id: 'b', title: 'Room 2', eventColor: 'green' },
{ id: 'c', title: 'Room 3', eventColor: 'orange' },
{ id: 'd', title: 'Room 4', eventColor: 'red' },
{ id: 'e', title: 'Room 5', eventColor: 'red' },
{ id: 'f', title: 'Room 6', eventColor: 'red' },
{ id: 'g', title: 'Room 7', eventColor: 'red' },
{ id: 'h', title: 'Room 8', eventColor: 'red' }
],
events: [
{ id: '1', resourceId: 'b', start: '2020-02-05T02:00:00', end: '2020-02-05T07:00:00', title: 'event 1' },
{ id: '2', resourceId: 'c', start: '2020-02-05T05:00:00', end: '2020-02-05T22:00:00', title: 'event 2' },
{ id: '3', resourceId: 'd', start: '2020-02-05', end: '2020-02-05', title: 'event 3' },
{ id: '4', resourceId: 'a', start: '2020-02-05T03:00:00', end: '2020-02-05T08:00:00', title: 'event 4' },
{ id: '5', resourceId: 'b', start: '2020-02-05T00:30:00', end: '2020-02-05T02:30:00', title: 'event 5' }

],
selectable: true,
editable: true,
nowIndicator: true,
minTime: "06:00:00",
maxTime: "30:00:00",
droppable: true
});

calendar.render();
};

我在 BundleConfig.cs 中的 JS 脚本:

                "~/Scripts/packages/core/main.js",
"~/Scripts/packages/daygrid/main.js",
"~/Scripts/packages/interaction/main.js",
"~/Scripts/packages/timegrid/main.js",
//"~/Scripts/packages/list/main.js",

"~/Scripts/packages/resource-common/main.js",
"~/Scripts/packages/resource-timegrid/main.js",
"~/Scripts/packages/resource-daygrid/main.js"

和CSS:

                "~/Scripts/packages/core/main.css",
"~/Scripts/packages/daygrid/main.css",
"~/Scripts/packages/timegrid/main.css",
//"~/Scripts/packages/list/main.css",
"~/Scripts/packages/external-events/external-events.css"

使用:fullcalendar-4.3.1.zip

最佳答案

只需将“~/Scripts/packages/resource-daygrid/main.js”移至“~/Scripts/packages/resource-timegrid/main.js”上方我认为,在 BundleConfig.cs 中,所以它首先加载。

该错误提示resourceTimeGrid找不到resourceDayGrid(它所依赖的)。如果稍后加载resourceDayGrid,那就有意义了。

所以你最终会得到

...
"~/Scripts/packages/resource-common/main.js",
"~/Scripts/packages/resource-daygrid/main.js"
"~/Scripts/packages/resource-timegrid/main.js",

关于javascript - 如何在 v 4.3.1 中使用 FullCalendar resourcesTimeGridDay?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60078843/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com