Home > Blockchain >  How can I display data in Vue
How can I display data in Vue

Time:01-10

I'm working on a project using Laravel and VueJs, i'm getting some data using Axios, but i'm not able to display it on my component,

This my data returned :

{
    "record": [
        {
            "id": 1003,
            "name": "audreanne87",
            "email": "[email protected]",
            "email_verified_at": "2022-01-08T02:10:04.000000Z",
            "created_at": "2022-01-08T02:10:04.000000Z",
            "updated_at": "2022-01-08T02:10:04.000000Z"
        }
    ]
}

When I do {{ record }} it works fine. But when I do {{ record.id }} I don't get any thing

CodePudding user response:

Your record is an array of objects. And you are trying to access an object directly which is not correct. You can access the data using an index. Try adding record[0].id in the template and see if it works.

CodePudding user response:

The problem was in my state.js

was like that record:{} changed to record:[{}]

  •  Tags:  
  • Related