简体   繁体   English

如何使用全日历在单元格中设置星期几和月份名称

[英]How to set day of the week and month name in the cell using fullcalendar

I'm using plugin fullcalendar for my project, but I have a problem that I can't show day of the week and the month name in the cell. 我正在为我的项目使用插件fullcalendar,但是我有一个问题,无法在单元格中显示星期几和月份名称。 How can I solve this problem? 我怎么解决这个问题?

the result whick I expect: 我期望的结果是: 在此处输入图片说明

$('.js-fullcalendar').fullCalendar({
    header: {
        right: 'today',
        center: 'prev, title, next',
        left: ''
    },
    navLinks: true,
    editable: true,
    eventLimit: true,
    events: exhibitionList,
    eventColor: '#3279b7',
    columnFormat: 'dddd',
    eventRender: function (event, element) {
        if (event.logo) {
            element.find(".fc-title").prepend("<img class='fcalen__img' src=" + event.logo + ">").append("<span class='fcalen__city'>" + event.city + "</span>");
        }
    }
});

I've found the solution: 我找到了解决方案:

$('.js-fullcalendar').fullCalendar({
  header: {
    right: 'today',
    center: 'prev, title, next',
    left: ''
  },
  navLinks: true,
  editable: true,
  eventLimit: true,
  events: exhibitionList,
  eventColor: '#3279b7',
  columnFormat: 'dddd',
  dayRender: function(date, cell) {
    var weekDay = date.format("dddd");
    var month = date.format("MMMM");
    var day = date.format("D");
    cell.html("<span class='fcalen__week-day'>" + weekDay + "</span>" + "<br>" + "<div class='fcalen__month-name'>" + day + "  " + month + "</div>");
  },
  eventRender: function(event, element) {
    element.find(".fc-title").prepend("<img class='fcalen__img' src=" + event.logo + ">").append("<span> / <span><span class='fcalen__city'>" + event.country + " " + event.city + "</span>");
  }
});

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

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