I am currently working on a bookstore application using Vue.js. The book data is stored in this API . However, I am encountering issues displaying the information on my HTML page with the provided function and I am struggling to identify the root cause:
<div id="list-books" v-if="books && books.length">
<div>Cover page: <strong>{{ books }}</strong></div>
<div>Details: <strong>{{ books.detalle }}</strong></div>
<div>Title: <strong>{{books.titulo}}</strong></div>
<div>Description: <strong >{{books.descripcion}}</strong></div>
<div>Language: <strong>{{books.idioma}}</strong></div>
</div>
<div class="text-center" v-else> No results! </div>
new Vue({
el: "#vue-app",
data() {
return {
title: "Ubiqum Bookstore",
books: []
};
},
methods: {
getAPI() {
axios
.get("https://api.myjson.com/bins/1h3vb3")
.then(response => {
this.books = response;
})
.catch(e => {
console.log("No found!");
});
}
}
});