I have a new problem. Lets say i have a JSON like this :
{
"games": [
{
"players_in_game": [
{
"id": 1,
"player": {
"id": 1,
"player": "Jack Bauer",
"email": "[email protected]"
}
},
{
"id": 2,
"player": {
"id": 2,
"player": "Chloe O'Brian",
"email": "[email protected]"
}
}
]
},
]
My idea is to use vuetify in order to build a table with part of this data. Thus already in the data return i initialized its headers, and the items already were bound to the computed method which already through its getter reaches to the storaged json in my random state variable(im using vuex). But still can't find the way of filling the table with data in fact.
Lets say i declared 2 headers(Player1 and Player2), and the items already bound to the api request give me 2 empty rows in the table vuetify.(cause the json object has to element) I want to pass to each correspondent header its player's name. On my html would be something like this:
<v-data-table :headers="headers" :items="method to get JSON" ">
<tr v-for="(general) in method to get JSON" v-bind:key="general">
<td >{{ general.any code to reach to the player's game }}</td>
......
......
</v-data-table>
I did try to use a conventional for loop to iterate over the Json and fill the rows but didn't work. The follwing code is the script:
<script>
export default {
name: "Games",
data(){
return {
headers:[
{
text:'Game #',
align: 'left',
sortable: false,
value: 'name',
},
{text:"Player 1",value:"Player 1"},
{text:"Player 2",value:"Player 2"},
]
}
},
computed:{
method to get JSON:Any
}
Any advice or help please?