vue search app
JavaScript
const app = new Vue({
el: 'body',
data: {
furnitura: [],
loading: false,
error: false,
query: ''
},
methods: {
search: function() {
this.error = '';
this.furnitura = [];
this.loading = true;
this.$http.get('/api/search?q=' + this.query).then((response) => {
response.body.error ? this.error = response.body.error : this.furnitura = response.body;
this.loading = false;
this.query = '';
});
}
}
});