B
B
BonBon Slick2017-10-12 14:32:19
Vue.js
BonBon Slick, 2017-10-12 14:32:19

How to access object parameter by key?

props: [
            'user'
        ],
  mounted: function(){
            console.log(this.user);
        },

Will return:
{"id":1,""slug":"1","nickname":"qweasdqwe","email":"[email protected] ...

When trying to get:
mounted: function(){
  console.log(this.user.nickname); // undefined

Will return undefined , how to get the parameters of the object then?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2017-10-12
@BonBonSlick

Or maybe you don’t have an object there, but a json string?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question