[Vuejs]-How to set a button on Vue to appear once all API calls have finished retrieving data?

0👍

If I understood it correctly you just want to wait for all your parallel api calls to complete to then show a button somewhere in the template, right? If that’s the case, it can be achieved with await Promise.all without any computed property. Something like:

this.showButton = true;
await Promise.all(
    idSets.map(async (ids) => {
        await api.budget.calculateTotalsForBudgets(ids, this.user.userId);
    })
);
this.showButton = false;

I’ve added this new showButton state as an example, but maybe you could even use your existing isLoading state — just move it below.

Leave a comment