离子无限滚动只能运行一次

时间:2019-03-27 10:36:36

标签: typescript ionic4

我有一个问题,那就是无限滚动...它只能工作一次。请帮我,我不知道该怎么做

getProdutosLazyLoading(event) {
    console.log(event);
    this.pagina++;
    let idCliente = sessionStorage.getItem('idCliente');
    setTimeout(() => {
      this.getProdutos = this.ProdutosService.getProdutos({
          key: "lista",
          id_mercado: this.idMercado,
          id_cliente: idCliente,
          filtro: this.searchinput.value,
          preco_cliente: this.preco,
          pagina: this.pagina,
          por_pagina: 2
        })
        .then(result => {
          let res: any = result;
          //this.produtos = res.produtos;
          let produtosNovos = res.produtos;
          for(const produto of produtosNovos){
            this.produtos.push(produto);
          }
          event.target.complete();

          /*if(produtosNovos == null){
            event.target.disabled = true;
          }*/

          //this.produtos.push(res.produtos);
          console.log(this.produtos);
      });
    //}, 500);
  }

0 个答案:

没有答案
相关问题