please i'll appreciate some help with this issue am facing on my vuejs frontend.
This is my js(vue) logic
new Vue({
el: '#products',
data () {
return {
products: {}
}
},
methods: {
getProducts: function() {
axios.get(serviceBase + 'products')
.then(function (response) {
this.products = response.data.data
})
.catch(function (error) {
console.log(error)
})
}
},
created: function() {
this.getProducts()
var p = this.products
}
})
and then the html
<div class="table-responsive" id="products">
<table class="table table-hover">
<thead>
<th>ID</th>
<th>Name</th>
<th>Category</th>
<th>Description</th>
<th>Color</th>
<th>Price</th>
<th>Actions</th>
</thead>
<tbody>
<template v-for="(prod, index) in products">
<tr>
<td>{{index+1}}</td>
<td>{{prod.prod_name}}</td>
<td>{{prod.cat_name}}</td>
<td>{{prod.prod_descrip}}</td>
<td>{{prod.prod_color}}</td>
<td>₦{{prod.prod_price}}</td>
<td></td>
</tr>
</template>
</tbody>
</table>
</div>
But then the products json array is not printing out on the table, please is there something am doing wrong?