在React Gantt时间轴中突出显示当前日期

时间:2020-01-20 12:09:32

标签: reactjs gantt-chart

我正在使用react-gantt时间轴软件包,我不知道如何在react gant时间轴中指示当前日期。 我正在寻找垂直条做同样的事情。

1 个答案:

答案 0 :(得分:0)

您可以定义自定义TimelineMarkers

import Timeline, {
  TimelineMarkers,
  CustomMarker,
  TodayMarker,
  CursorMarker
} from 'react-calendar-timeline'

<Timeline>
  <TimelineMarkers>
    <TodayMarker />
    <CustomMarker date={Date.now()} />
    <CustomMarker date={tomorrow}>
      {/* custom renderer for this marker */}
      {({ styles, date }) => {
        const customStyles = {
          ...styles,
          backgroundColor: 'deeppink',
          width: '4px'
        }
        return <div style={customStyles} onClick={someCustomHandler} />
      }}
    </CustomMarker>
    <CursorMarker />
  </TimelineMarkers>
</Timeline>