Vue JS returns [__ob__: Observer] data instead of my array of objects

后端 未结 11 784
予麋鹿
予麋鹿 2020-12-08 08:54

I\'ve created a page where I want to get all my data from the database with an API call, but I\'m kinda new to VueJS and Javascript aswell and I don\'t know where I\'m getti

11条回答
  •  有刺的猬
    2020-12-08 09:45

    If your goal is debugging WHAT included in Observer Vue instance, this is my solution:

    Print out that variable in template block belongs to your Component

    After that, you can reformat the structure of the output to observe the detail.

    For example:

    
    

    Another way, if you wanna see it in console, you should put the console.log into mounted phase. Because at created phase, the this.pigeons still be empty. Ref: https://vuejs.org/v2/guide/instance.html#Lifecycle-Diagram

    Hope this helpful.

提交回复
热议问题