[Vuejs]-TypeError: Cannot read property '' of undefined

0👍

You should add to your data (or props) property posts because posts doesn’t exist in scope of vue component:

export default {  
    data(){
        posts: [],
    }
}

And later in the methods of code you can set posts array like this:

this.posts = response.data;

Leave a comment