简体   繁体   English

fullcalendar 格式 dayGrid 日单元格显示月份和日期

[英]fullcalendar format dayGrid day cell to show month and day

I want to show the day of each cell as the "month day" I've already try to use slotLabelFormat, and all the others slotLabel, but any of those worked.我想将每个单元格的日期显示为“月日”,我已经尝试使用 slotLabelFormat 和所有其他 slotLabel,但其中任何一个都有效。 The picture below is how I did using JS, but when I perform any action on the calendar, it got a refresh and render the default, which is only the day下图是我用JS做的,但是当我对日历执行任何操作时,它会刷新并呈现默认值,即只有一天在此处输入图像描述

在此处输入图像描述

Solved: I added the dayRender method like this:已解决:我添加了这样的 dayRender 方法:

dayRender(eventInfo){
 if(eventInfo.view.type === 'dayGridMonth'){
  return eventInfo.el.innerHTML = moment(eventInfo.el.dataset.date, 'YYYY-MM-DD').format('MMM DD');
 }
}

and this on my CSS这在我的 CSS

.fc-day-number{
    visibility: hidden;
}

There is a page on how to customize with your own Javascript:有一个页面介绍如何使用自己的 Javascript 进行自定义:

https://fullcalendar.io/docs/custom-view-with-js https://fullcalendar.io/docs/custom-view-with-js

Specifically, there is具体来说,有

renderDates(dateProfile) { // responsible for rendering the given dates }

and more steps on how to accomplish a more customized view.以及有关如何完成更多自定义视图的更多步骤。 Hope this helps!希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM