【发布时间】:2023-03-14 06:42:01
【问题描述】:
我能够通过 slotPropGetter 道具编辑周视图槽样式,但找不到在没有事件时如何将文本传递到槽的解决方案。图片上的示例。
当前表:
<BigCalendar
selectable
className="calendar"
popup
localizer={localizer}
formats={formats}
events={this.state.events}
defaultView={BigCalendar.Views.WEEK}
views={['week']}
step={90}
timeslots={1}
min={new Date(2019, 0, 1, 8, 0)} // 8.00 AM
max={new Date(2020, 0, 1, 22, 0)} // Max will be 6.00 PM!
onSelectEvent={event => this.showModalHandler(event, false, true)}
onSelectSlot={event => this.showModalHandler(event, true, false)}
eventPropGetter={this.eventStyleHandler}
slotPropGetter={this.slotStyleHandler}
components={{
event: this.CustomEvent,
week: {
header: CustomDateHeader,
},
}}
/>
也许使用 timeSlotWrapper?以某种方式在 timeSlopWrapperProps.children 中更改内容?
const timeSlotWrapper = timeSlotWrapperProps => {
return timeSlotWrapperProps.children
}
React 大日历 api 文档:http://jquense.github.io/react-big-calendar/examples/index.html#api
【问题讨论】:
-
你的项目有游乐场吗?
-
@slesh 你可以在这里找到沙盒:codesandbox.io/embed/…
标签: javascript reactjs react-big-calendar