i have an array with objects like with id and name props. In foreach i loop all objects and display the props in vue template.
<div class="column is-flex" v-for="(pic, index) in formdata.pictures" :key="index">
<p>{{pic.name}}</p>
<p>{{getPictureLocation(pic.id)}}</p>
</div>
getPictureLocation(id) {
axios
.post("/api/frontend/option/picture", {
id: id
})
.then(response => {
let data = response.data.items;
if (data != null) {
return data.name;
}
});
}
In data.name is the right value like London or Berlin ... The return value is not displayed in the html. It shows always "".
What can i do to display the return value?