首页 > 解决方案 > iPhone上的Fullcalendar(角度)糟糕的性能

问题描述

我已经在 Angular 中使用了 fullcalendar 包来显示一个月的事件。日期和事件都可以点击,并且有处理日期点击和事件点击的功能。它在台式机和安卓手机上运行良好,但问题出在 iPhone 上,每次点击日期/事件都会有明显的延迟。点击一个事件后,需要一些时间来呈现选择。

我注意到每次点击事件时都会调用 eventContent 并且多次调用它,有时会收到以下警告,

[Violation] 'setInterval' handler took 52ms
[Violation] 'setTimeout' handler took 66ms
[Violation] Forced reflow while executing JavaScript took 31ms

我已经尝试过评论选择处理和 eventContent 函数,但没有发现任何显着差异。

全日历初始化


    this.calendarOptions = {
    headerToolbar: {
      left: '',
      right : 'prev title next'
    },
    customButtons:
    {
    prev:{
      click:this.previousMonth.bind(this)
    },
    next:{
      click:this.nextMonth.bind(this)
    },
    },
    showNonCurrentDates: false,
    fixedWeekCount: false,
    views: {
      dayGridMonth: { // name of view
        titleFormat: {month:"2-digit"}
      }
    },
    dayCellContent: arg => {
      return arg.date.getDate();
    },
    aspectRatio:1.2,
    height: 'auto',
    unselectAuto: false,
    eventColor:"white",
    locale:jaLocale,
    rerenderDelay:1,
    initialDate: 2021-09-17,
    events:this.Price,
    eventContent:this.renderEvent, 
    select: this.handleDateSelect.bind(this),
    dateClick: clickInfo => {
      const calendarApi = clickInfo.view.calendar;
      calendarApi.select(clickInfo.date);
    },
    eventClick: clickInfo => {
      const calendarApi = clickInfo.view.calendar;
      calendarApi.select(clickInfo.event.start);
    },
    datesSet: this.handleDatesSet.bind(this),
    unselect: this.handleDateUnselect.bind(this)
    };

完整日历

标签: iosangulariphoneperformancefullcalendar

解决方案


推荐阅读