'Printing the data posted with axios to the screen with node js

I want to print the data in the inputs in the image to the screen via node js, how can I do this?



Solution 1:[1]

You could use a combination of an Array and an v-for statement

Basically:

//The UI
    <ul>
        <li v-for="(item, key) in array" v-bind:key="key">
            //Here you can use now every item in the Array like this for example
            <span>{{ item.name }}</span>
        </li>
    </ul>

//The code
export default {
    data() {
        return { array: [] };
    },
    methods: {
        apiDataFunction() {
            axios
                .post('xxx') //Or whatever you have
                .then((res) => {
                    this.array.push(res.data);
                });
        }
    }
};

If you could give some more information I could help more. For example, how the data looks that you retrieve with axios etc.

I didn't test this code personally so it may be, that you would need to pack this array into an computed statement

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Criepstar