5
votes

I use axios to get information from DB. I get response from server in array:

response

My html tags: htmlTag

Js code looks like this:

    data() {
        return {
            departments: {
                id: 0,
                name: "name of company",
                nameZod: "name of company dif"
                },
            };
       },
    created() {
        axios
            .get('/SomeController/Departments')
            .then(response => {
                this.departments = response.data;
                console.log(this.departments);
            })
        }

I get an error: Cannot read property '_wrapper' of undefined. Its very strange cause I use similar code in other module and it works correctly.

5
Can you please post the full error message including stack trace showing files and line numbers? - Phil

5 Answers

35
votes

Maybe you have defined a function call somewhere (@click=something) and you haven't defined yet the function in methods. This happened to me, maybe it can be useful for someone

7
votes

This error occurs when a v-on:click OR @click directive in the template is missing the function it's pointing to, inside methods in your component.

Example:


//template
@click="callAgain"
...
methods : {
  //no function called callAgain
}

0
votes

you just need to initiate your departments as an array like this:

    data() {
        return {
            departments: [
                {
                    id: 0,
                    name: "name of company",
                    nameZod: "name of company dif"
                },
            ],
        };
    },

0
votes

It happened to me too, but with different reason (Vue + Vuetify. @click function must be attached to btn, not icon like below.

   <v-btn fab small>
       <v-icon @click="sendMessage">send</v-icon>
   </v-btn>
0
votes

You are calling some function in your component which is not defined in your component yet, Please check all of your functions in your component are defined.

For Example

You are using @click="something" but something() not defined in your component.