![](/img/trans.png)
[英]React-Calendar-TimeLine is it possible to change the color of text on the header?
[英]react calendar timeline issue
我在react-calendar-timeline
中遇到了一些問題。 我使用這個 package 創建一個日歷:
https://www.npmjs.com/package/react-calendar-timeline
我的代碼:
this.state = {
items: [],
groups: [],
componentDidMount() {
var self = this;
axios
.get(
`http://localhost/v1/appointments`
)
.then(function(res){
....
const itemsArray = items;
const groupsArray = groups;
self.setState({
groups: groupsArray,
items: itemsArray,
});
});
}
<Timeline
groups={this.state.groups}
items={this.state.items}
defaultTimeStart={moment().subtract(1, 'hour')}
defaultTimeEnd={moment().add(3, 'hour').add(30, "minute")}
/>
我想在日歷上顯示current date vertical lines
預計 output
我應該怎么辦? 有人告訴我嗎?
您可以定義自定義 TimelineMarkers
import Timeline, {
TimelineMarkers,
CustomMarker,
TodayMarker,
CursorMarker
} from 'react-calendar-timeline'
const today = new Date()
<Timeline>
<TimelineMarkers>
<TodayMarker />
<CustomMarker date={today} />
<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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.