0π
β
If the JSON response looks exactly like this:
{"id":1,"balance":10.0,"exposure":7.0,"free_funds":80.0}
Then you donβt even need the v-for
because there is only one thing to iterate over.
If you want a v-for
, force the data to come back as an array by wrapping it so that it would be this:
[ {"id":1,"balance":10.0,"exposure":7.0,"free_funds":80.0} ]
So:
return { results: [res.data] };
0π
See the docs
<li v-for="(result, key) in results" :key="result">
<p>{{ result }} {{ key }}</p>
</li>
Source:stackexchange.com