I
I
igor_solweb2020-08-13 01:24:04
Vue.js
igor_solweb, 2020-08-13 01:24:04

Routes vue axios arrays, how to understand how routes work?

Don't scold me right away, I'm new to vue.js.
I am doing a small test project, the structure is ready, there is an object with arrays of the form

dataStorage: [
{
name: 'Igor',
age: 32,
hair: 'black'
},
{
name: 'Valera',
age: 32,
hair: 'black'
},
......... и т.д.
]


I display this object line by line through v-for. All is well with this.
This array object was made to test the loop so that everything outputs well for layout.
But now the task is to use the magic button "load data" to load all the elements of the arrays that are there into this dataStorage object and also display them line by line, I have a so-called route to receive this data from the server, I checked it through Postman, everything works .
So tell me how and where to apply this route correctly in the project so that I can load the data into my dataStorage object and display it on the page?
To be honest, I rummaged through a bunch of information and vidos, in my head there is a little mess on MongoDB, Axios, Express.js
The project itself, by the way, is on MEVN.
I would be very grateful if there is an example or explanation of what a route is and how to apply it correctly in order to get data from the server with a Get request and display it in your dataStorage object . Thanks

in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nurasyl Aldan, 2020-08-13
@igor_solweb

Routes are pages implemented dynamically in JavaScript.
Such as:
/about
/search
/help
/people

export default {
    data() {
        return {
            dataStorage: new Array(),
        }
    },
    mounted() {
        this.dataStorage.push({
            name,
            age,
            hair,
        })
    },
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question