【问题标题】:Create events in React Big Calendar在 React Big Calendar 中创建事件
【发布时间】:2016-09-19 17:09:37
【问题描述】:

我正在尝试通过拖动在react-big-calendar 中创建事件,将数据放入Tootip 表单并向服务器发送请求以保存它。 拖动事件后出现问题,选择消失了:我需要它一直保留到我提交事件。现在 it works like this

在文档/示例中他们有警报,哪个 corse 停止执行功能并且选择保持不变:

 <BigCalendar
      selectable
      events={events}
      defaultView='week'
      scrollToTime={new Date(1970, 1, 1, 6)}
      defaultDate={new Date(2015, 3, 12)}
      onSelectEvent={event => alert(event.title)}
      onSelectSlot={(slotInfo) => alert(
        `selected slot: \n\nstart ${slotInfo.start.toLocaleString()} ` +
        `\nend: ${slotInfo.end.toLocaleString()}`
      )}
    />

如果我在 onSelectSlot 函数结束时出现错误,它也会保持打开选择,但我需要在提交后关闭。

【问题讨论】:

    标签: reactjs calendar


    【解决方案1】:

    使用onSelecting 方法拖动选择,这将为您提供一个对象,其中包含选择的开始和结束日期{ start: Date, end: Date },并确保此方法不返回false,有关更多信息,请参阅文档here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-07-14
      • 1970-01-01
      • 2021-10-03
      • 1970-01-01
      • 2018-06-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多