0👍
You can return the entries in the object as an array using Object.entries()
.
So, in javascript you can use
Object.entries(obj).forEach(entry => {
const [key, value] = entry;
console.log(key, value);
});
and with v-for in vue you could write something like
<div v-for="(key, value, index) in Object.entries(obj)">
{{ index }} {{ key }} {{ value }}
</div>
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries
Source:stackexchange.com