1

在 resize 事件中,自定义 css 类被删除,并且在 mouseup 上, beforeWeekViewRender 被触发,并且连续地,自定义 css 被重新添加。这发生在周视图中。

我可以找到问题的根本原因。在日视图中工作正常。

`在.html中

`

<mwl-calendar-week-view *ngSwitchCase="CalendarView.Week"
                          (beforeViewRender)="beforeWeekViewRender($event)"
                          [viewDate]="viewDate"
                          [events]="calendarEvents"
                          [refresh]="refresh"
                          (eventClicked)="handleEvent('Clicked', 
                          $event.event)"
                          (eventTimesChanged)="eventTimesChanged($event)"
                          [hourSegmentTemplate]="weekViewHourSegmentTemplate"
                          >
</mwl-calendar-week-view>

`

In .ts

`

public eventTimesChanged({
    event,
    newStart,
    newEnd
  }: CalendarEventTimesChangedEvent): void {
    let disabledArea = false;
    if (!this.checkIfSegmentIsDisabled(newStart, 2)) {
      event.start = newStart;
    } else {
      disabledArea = true;
    }
    if (!this.checkIfSegmentIsDisabled(newEnd, 2)) {
      event.end = newEnd;
    } else {
      disabledArea = true;
    }
    if (!disabledArea)
      this.handleEvent('Dropped or resized', event);
    else alert("Excedio el limite");
    this.refresh.next();
  }

`

在调整大小事件期间,不应删除 css

4

0 回答 0