如何检测正在使我的Web应用变慢的原因?

时间:2019-07-07 16:56:50

标签: angular typescript

所以我的代码可以正常工作,但似乎会降低我的表的显示速度,检查了Chrome在网络中的速度,并且数据加载正常(1.81秒),也尝试使用过滤器或单击导航栏中的另一个链接时反应相当缓慢。 这是我的代码https://github.com/ace182/resume/tree/master/app%20viernes/src/app/tabla

的链接
TS

//Table
ngOnInit() {

    this.consulta();
    this.dtOptions = {
      pageLength: 15,
      responsive: true,
      dom: 'Bfrtip',
      buttons: [
        'print',
        'excel'
      ],
      language: {
        search: 'Búsqueda',
        lengthMenu: 'Cantidad _MENU_ registros por pagina',
        emptyTable: 'No hay datos disponibles',
        info: 'Registro _START_ a _END_ de _TOTAL_ consultados',
        infoEmpty: 'Registro 0 a 0 de 0 consultados',
        paginate: {
          first: 'Primero',
          last: 'Ultimo',
          next: 'Siguiente',
          previous: 'Anterior'
        }
      }
    };


  }

  ngOnDestroy():void{
    this.alive = false;
    // Do not forget to unsubscribe the event
    $.fn['dataTable'].ext.search.pop();
    this.dtTrigger.unsubscribe();
    return this.ngOnInit();

  }

//Getting data to fill my table
consulta() {
    this.service.getAll().pipe(takeWhile(() => this.alive)).subscribe(persons => {
      this.persons = persons;
      // Calling the DT trigger to manually render the table
      console.log(this.persons);
      this.dtTrigger.next();

    });
  }

0 个答案:

没有答案