【问题标题】:How to navigate to the next month when in the week view in react big calendar在反应大日历的周视图中如何导航到下个月
【发布时间】:2020-09-24 10:41:32
【问题描述】:

我目前将日历中的视图属性设置为“周”

function CalendarSchedule({eventList=[]}) {

const localizer =momentLocalizer(moment);

return (
        <Calendar
            localizer={localizer}
            view='week'
            events={eventList}
            startAccessor="start"
            endAccessor="end"
        />
       )
      }

export default CalendarSchedule;

周视图中的后退和下一个按钮将在单击时显示下一周

我想要两个额外的按钮,点击后可以跳转到下一个月或上个月。

【问题讨论】:

    标签: react-big-calendar


    【解决方案1】:

    您可以使用 date 作为受控道具和自定义工具栏来添加其他按钮。 onNavigate 在 props 中可用,所以你使用它

    const navTwoWeeks = () => {
      const {date, onNavigate} = this.props;
      // do your date math to figure out new date
      onNavigate(navigate.DATE, newDate);
    };
    

    【讨论】:

      猜你喜欢
      • 2023-02-04
      • 2019-11-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多