[Vuejs]-How I can get specific object value in vuejs?

0👍

I’m guessing your app structure looks like the following:

new Vue({
  el: '#app',
  data: [{ "id": 1, "name": "Lorem Ipsum Name","address": "Lorem Ipsum Street" }]
})

I don’t think you can grab array values directly off the data object like that in Vue. Try changing it to this:

new Vue({
  el: '#app',
  data: {
    "data": [{ "id": 1, "name": "Lorem Ipsum Name","address": "Lorem Ipsum Street" }]
  }
})

This fiddle is helpful to experiment with: https://jsfiddle.net/chrisvfritz/50wL7mdz/

0👍

You can get the data object property with $data.

So you can do the following(https://jsfiddle.net/tenkz5j9/3/):

<p>{{ $data[0].id }}</p>

Leave a comment