【问题标题】:big calendar react Can we have multiple color on different dates of Month?大日历反应我们可以在月份的不同日期有多种颜色吗?
【发布时间】:2020-03-05 11:21:39
【问题描述】:

大日历反应我们可以在月份的不同日期有多种颜色吗?

假设:每月的每个日期都会根据其事件具有不同的颜色。

【问题讨论】:

  • 能否更具体地说明您的问题?
  • 我有日历控件,我想在不同的日期有不同的颜色。喜欢:3 月 1 日红色至满盒 3 月 2 日蓝色至满盒 3 月 3 日灰色至满盒

标签: reactjs react-big-calendar


【解决方案1】:

dayPropGetter 允许您根据日期在月视图中设置样式,但它无法访问其他日历道具(如 events

方法签名:

(date: Date) => { className?: string, style?: Object }

用法:

const dayPropGetter = (date) => {
  // build some className from the `date` and/or
  // build some style definition from the `date` data
  return { className, style }
}

<Calendar dayPropGetter={dayPropGetter} />

因此,如果您想以某种方式突出显示每周三、周末或“今天”,您可以使用它来执行此操作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-21
    • 2017-05-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多