Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Aetrox's avatar

getting one array from axios get

Hello everyone,

i have a question:

new Vue({

    el: '#root',

    data: {

        keywords: '', 

        users: [],

        selectedUser: []

    },

    mounted() {

            axios.get('/test').then(response => this.users = response.data);

    },

    methods: {

        fetch() {
            axios.get('/fetch', { params: { keywords: this.keywords } })
                .then(response => this.selectedUser = response.data)
                .catch(error => {});

        }

    }


});

I fetch all usernames and output them in a select list. Then i search for the selected user and fetch all his data. The Output is then a Array in an Array.

I can only output the userdata with an v-for, is there an option to do this without v-for?

thank you very much

Simon

0 likes
3 replies
topvillas's avatar
Level 46

Show us your controller code for the endpoint.

It sounds like you're using a get rather than find or first when fetching the user data.

Aetrox's avatar

thank you very much, it was the get. Yes i rename it, was just my example build so i could better understand what it does.

Please or to participate in this conversation.