I want to display the data in table using vue-datatable but it is not working. Here is the code that i am using ,i am getting data in json format but it is not appending with datatable can anyone help me in this or any better way to do this. Thanks in Advance
////main.js////
import Vue from 'vue'
import { VuejsDatatableFactory } from 'vuejs-datatable';
Vue.use( VuejsDatatableFactory );
<script>
import axios from 'axios';
export default {
data: () => ({
drawer: null,
columns: [
{label: 'id', field: 'recData.id'},
{label: 'user ID', field: 'recData.userId'},
{label: 'Title', field: 'recData.title'},
{label: 'Description', field: 'recData.body'},
],
recData:[]
}),
created() {
//api for getting posts details
const token = 'https://jsonplaceholder.typicode.com/posts';
axios({
method: 'get',
url: token,
})
.then((response) => {
this.recData = response.data;
})
.catch((error) => {
this.errors = error;
})
},
}
</script>
<v-content>
<v-container class="fill-height" fluid>
<v-row align="center" justify="center">
<span class="mb-5">{{ recData }}</span>
<datatable :columns="columns" :data="recData"></datatable>
</v-row>
</v-container>
</v-content>
