Hi all i have this issue i had to return of axios, that I am not positioning in the right place i show my basic code:
pictures(city) {
axios
.get(
`https://pixabay.com/api/?key=***********&q=${city}&image_type=photo&pretty=true`
)
.then((resp) => {
if(resp.data.hits.length)
// console.log(resp.data.hits[0].largeImageURL)
return resp.data.hits[0].largeImageURL
else
// console.log('ELSE')
return 'https://cdn2.civitatis.com/reino-unido/londres/guia/aeropuerto-gatwick.jpg'
});
},
And what i want to do, is call this method in my HTML like that
<img :src="pictures(item.city)" />
And i wait the return that would be a link from the api, but i must be wrong somewhere. Sorry if it's basic, and if i forgot to do something basic.
Thank you very much for the time taken to my question