E
E
Erik21212018-04-20 21:38:03
Vue.js
Erik2121, 2018-04-20 21:38:03

Can't access properties of Vue object. How to be?

Good evening!
I encountered such a problem in Vue.js, in general, there is a property:
responseData: []
in the Vue object, it is successfully filled with data from the server, as a result, the following is obtained there:

0: {
   rooms: {
       0: {
           "type": 1
       },
       1: {
           "type": 2
       },
       2: {
           "type": 3
       }
   }
}

I can’t access it inside the object, I try, for example, like this: It doesn’t work, although in the DOM it turns out to sort through the elements if you specify:
this.responseData[0]
<span v-for="post in responseData[0]">{{ post.title }}</span>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Little Vasya, 2018-04-20
@emilov

You create an empty array, let posts: []'s say in the data object, and then you assign data from the server this.posts = responseData, then output it through v-for already through the posts object

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question