vue search
by schel4ok
JavaScript
<template>
</template>
<script>
export default {
data () {
return {
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 = '';
});
}
}
}
</script>