O
O
Orc2019-06-26 11:12:59
Express.js
Orc, 2019-06-26 11:12:59

How to output data from MongoDB to vue-tables-2 (Express, Vue, Axios) table?

Good time, friends.
Can't output array data to vue-tables-2 table .
While table rows are generated according to array data.
5d1327a22e0e1107454087.png
The array from the base arrives successfully .
5d1328b62fbb0332702046.png
I receive data on the client through axios ...

<template>
    <div>
        <div class="row">
            <v-client-table :columns="columns" :data="customers" :options="options"></v-client-table>
        </div>
    </div>
</template>

import http from "<тут гружу axios>";

    export default {

        name: 'customers-list',
        data() {
            return {
                customers: this.customers,
                columns: ['code', 'name', 'status'],
                options: {

                    headings: {

                        code: 'Key',
                        name: 'Model',
                        status: 'Status'
                    },
                    sortable: ['code', 'name', 'status'],
                    filterable: ['code', 'name', 'status']
                }
            };
        },
        methods: {

            retrieveCustomers() {

                http
                    .get('/customers')
                    .then(response => {

                        this.customers = response.data;
                        console.log(this.customers);
                    })
                    .catch(e => {

                        console.log(e);
                    });
            }
        },
        mounted() {

            this.retrieveCustomers();
        }
    };

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question