尽管搜索了所有“重复事件”帖子,我还没有找到与我的问题类似的帖子...让我解释一下。
render: function (close) {
var calendarEl = document.getElementById('calendar');
calendar = new FullCalendar.Calendar(calendarEl, {
header: { left: 'today,prev,next', center: 'title',right: 'timeGridDay,timeGridWeek,dayGridMonth' },
buttonText: {day: 'ημέρα', week: 'εβδομάδα', month: 'μήνας', today: 'σήμερα'},
plugins: [ 'dayGrid','timeGrid','interaction','moment'],
nowIndicator: true,
eventSources: ['closedates.php' ],
...
});
正如你在上面看到的,除了标准事件源之外,我还使用了第二个(closedates.php)
if(!isset($holidays['noexist']))
{
$jsonholid=["id"=>'208',"editable"=>false,"description"=>"holiday","source"=>'closedates.php',"classNames"=>['holiday'],"title" => $holidays[0]['name'],"start" => $holidays[0]['date'],"end" =>$holidays[0]['date'],"backgroundColor"=>'#f48024'];
array_push($events, $jsonholid);
}
}
echo json_encode($events);
以上代码的作用是搜索数据库,如果有假期(显示)或业务用户已进入应用程序关闭天数(出于简洁原因未显示)。 在这两种情况下,JSON 响应都是使用可能跨越一天(如果是某天假期)或更多(暑假)的全天事件创建的
放假一天的JSON就是这样
[{"id":"208","editable":false,"description":"holiday","source":"closedates.php","classNames":["holiday"],"title":"\u039a\u03b1\u03b8\u03b1\u03c1\u03ac \u0394\u03b5\u03c5\u03c4\u03ad\u03c1\u03b1","start":"2021-03-15","end":"2021-03-15","backgroundColor":"#f48024"}]
现在的问题是: 当日历初始加载时它显示一个事件(只有一个在数据库中)...所以我通过 eventRender 访问的事件对象中有一个元素。
如果我去到下周有假期,问题就会出现......尽管一旦事件对象包含两个相同的元素就会呈现事件......对应于那个假期: 如果我下周去……另一个假期问题不会出现。 如果我回到非假期活动(第一张图片),问题再次出现 在初始加载时没有出现问题...但是在更改周并从次要事件源加载假期后,非假期事件受到影响
所以回顾一下......在上述之后......非假期事件和变更周期间遇到的第一个假期 似乎是带有 ident 值的 evetns(事件对象包含 2 个 ident 元素)。尽管被正确呈现 不知怎的,这两个事件相互纠缠在一起......
再看看这个原理图 schematic of problem
我希望得到一些建议,因为我找不到解决方案。