[Vuejs]-Uncaught TypeError: Cannot read property 'push' of undefined at Object.success

0👍

You need to initialize it to empty array before pushing objects,

  this.test = [];

EDIT

When using arrow function, the this property is not overwritten and still references the component instance.

 success:(data) => {
    console.log(data[0]['id']);
    this.test.push(4)
 }

Leave a comment