Skip to content
Advertisement

Vuejs Iterate through a ref object

I have a small problem, I get my ref object from that method

JavaScript

And i want to use another method using that ref object :

JavaScript

But i can’t iterate through :

JavaScript

Is there anyway to make that work ?

Thank you 🙂

Advertisement

Answer

As the response is an object and not an array, you cannot iterate over it with forEach, you need to use Object.entries()

JavaScript

And I would use a reactive object:

JavaScript

Of course if you want that count to be reactive as well you’d need to use a computed property.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement