title: Download after completing the request - vue-json-excel
body: <p>I'm using the <strong>vue-json-excel</strong> library that helps me download data from a json.</p>
  
  <p>where in the view of the vue I have:</p>
  
  <pre><code>&lt;div class="column is-narrow" @click="btDispatch"&gt;
      &lt;json-excel
        class   = "button is-primary"
       :data   = "routes"
       :fields = "json_fields_routes"
       :name    = "`descarga-rutas.xls`"&gt;
      &lt;span class="icon"&gt;&lt;i class="fa fa-download"&gt;&lt;/i&gt;&lt;/span&gt;&lt;span&gt;Descargar entregas&lt;/span&gt;
     &lt;/json-excel&gt;
  </code></pre>
  
  <p>Where:<strong>data = "routes"</strong> is the json that will be downloaded:</p>
  
  <pre><code>data () {
    return {
       json_fields_routes: {
         ruta_id: 'id',
         fecha: 'date',
         estado_codigo: 'route_state',
         estado: 'estado',
         vehículo: 'vehicle',
         conductor_codigo: 'worker.id',
         conductor_nombre: 'worker.name',
         hora_inicio: 'date_start_web',
         hora_fin: 'date_end_web',
         entregas: 'dispatches_count',
         pendientes: 'pendientes',
         entregados: 'entregados',
         parciales: 'parciales',
         no_entregados: 'noEntregados',
       },
       json_meta: [
        [
          {
            key: 'charset',
            value: 'utf-8',
          },
        ],
      ],
    }
  }
  </code></pre>
  
  <p>According to the documentation, I must do this to download Excel and it works correctly. The problem I have is that it is downloaded when there is existing data, but I am working with data that comes from the server and previously loaded the data in the load () but it takes a long time when there is a large amount of data to enter that section of the page, so I prefer that the download button compile the data and then download.</p>
  
  <p>So far I have:</p>
  
  <pre><code>methods: {
    btRoute() {
          this.axios.post('/routesdownload/filter_route/', this.params)
              .then((response) =&gt; {
                this.routes = response.data.results;
                for (let i = 0; i &lt; this.routes.length; i++) {
                  this.routes[i].pendientes = this.filterByStatus(this.routes[i].dispatches, 1);
                  this.routes[i].entregados = this.filterByStatus(this.routes[i].dispatches, 2);
                  this.routes[i].parciales = this.filterByStatus(this.routes[i].dispatches, 3);
                  this.routes[i].noEntregados = this.filterByStatus(this.routes[i].dispatches, 4);
                  this.routes[i].date = moment(this.routes[i].date).format('YYYY/MM/DD');
                  if (this.routes[i].date_start_web &amp;&amp; this.routes[i].date_end_web != null) {
                    this.routes[i].date_start_web
                    = moment(this.routes[i].date_start_web).format('YYYY/MM/DD HH:mm:ss');
                    this.routes[i].date_end_web
                    = moment(this.routes[i].date_end_web).format('YYYY/MM/DD HH:mm:ss');
                  } else {
                    this.routes[i].date_start_web = '-';
                    this.routes[i].date_end_web = '-';
                  }
                  if (this.routes[i].route_state === 1) {
                    this.routes[i].estado = 'Borrador';
                  } else if (this.routes[i].route_state === 2) {
                    this.routes[i].estado = 'Publicado';
                  } else if (this.routes[i].route_state === 3) {
                    this.routes[i].estado = 'Iniciado';
                  } else {
                    this.routes[i].estado = 'Terminado';
                  }
                }
              });
        },
  }
  </code></pre>
  
  <p>But this simply brings the data and the weapon according to the need, but how could you after completing the application, call the function you download with this library? I could do it with a <strong>callback</strong> or a <strong>promise</strong>, but how can I call that download function?</p>