nhn / tui.calendar

🍞📅A JavaScript calendar that has everything you need.
http://ui.toast.com/tui-calendar
MIT License
12.07k stars 1.31k forks source link

According to the official example, the error "formData. forEach is not a function" is reported after clicking the Edit Form Update button #1326

Open lyl-moon opened 1 year ago

lyl-moon commented 1 year ago

Version

2.1.3 react:16.13.1

Test Environment

Current Behavior

// Write example code
const getCalInstance = useCallback(() => calendarRef.current?.getInstance?.(), []);
const onBeforeUpdateEvent = (updateData) => {
    console.group('onBeforeUpdateEvent');
    console.log(updateData);
    console.groupEnd();

    const targetEvent = updateData.event;
    const changes = { ...updateData.changes };

    getCalInstance().updateEvent(targetEvent.id, targetEvent.calendarId, changes);
  };

  <Calendar
    height="900px"
    calendars={initialCalendars}
    month={{ startDayOfWeek: 1 }}
    events={initialEvents}
    template={{
      allday(event) {
        return `<span style="color: #fff; height: 80px; display: inline-block; background-color: ${event.backgroundColor};">${event.title}</span>`;
      },
      alldayTitle(e) {
        return 'alldayTitle';
      },
      popupEdit() {
        return '编辑';
      },
      popupDelete() {
        return '删除';
      },
      popupSave() {
        return '保存';
      },
      popupUpdate() {
        return '更新';
      },
    }}
    // theme={theme}
    timezone={{
      zones: [
        {
          timezoneName: 'Asia/Shanghai',
          displayLabel: '北京时间',
          tooltip: 'UTC+09:00',
        },
      ],
    }}
    useDetailPopup
    useFormPopup
    view={selectedView}
    week={{
      eventView: ['allday'],
      taskView: false,
    }}
    ref={calendarRef}
    onAfterRenderEvent={onAfterRenderEvent}
    onBeforeDeleteEvent={onBeforeDeleteEvent}
    onClickDayname={onClickDayName}
    onClickEvent={onClickEvent}
    onClickTimezonesCollapseBtn={onClickTimezonesCollapseBtn}
    onBeforeUpdateEvent={onBeforeUpdateEvent}
  />

Expected Behavior

Can be edited normally

adhrinae commented 1 year ago

@lyl-moon Hi, it works fine in my environment. Can you upload a minimal reproduction app by codesandbox or something?