I would like to use a method to make an API call in a v-for loop, the purpose is to load an object based on a UID.
My method looks like this:
methods: {
async getTodo(uid) {
const data = await axios.get(
"https://jsonplaceholder.typicode.com/todos/" + uid
);
return data;
}
}
From my understanding you can include methods inline as such:
{{ getTodo(2) }}
However this always returns [object Promise]
I must have misunderstand the use of methods for this purpose, or the async call in the method itself is incorrect — if anyone can clarify what is wrong here.