I have this JSON-array which looks like this:
"data": {
"cells": [
[
{
"rowIndex": 0,
"columnIndex": 0,
"value": "<p>This is some value</p>",
"type": "th",
"scope": "col"
},
{
"rowIndex": 0,
"columnIndex": 1,
"value": "<p>Another value</p>",
"type": "th",
"scope": "col"
}
],
[
{
"rowIndex": 1,
"columnIndex": 0,
"value": "<p>Blabla blabla</p>",
"type": "td",
"scope": null
},
{
"rowIndex": 1,
"columnIndex": 1,
"value": "<p>Lorem ipsum</p>",
"type": "td",
"scope": null
}
]
],
}
Now I want to render this data in a table in my vuejs-app, so I tried to do this:
First get the data through computed value:
computed: {
tableData() {
return this.content.data.cells;
},
},
Then render the data through a table:
<table>
<tr v-for="cell in tableData" :key="cell.id">
<template v-if="cell.type === 'th'">
<th v-for="header in cell" :key="header">
{{ header.value }}
</th>
</template>
<template v-if="cell.type === 'td'">
<td v-for="celldata in cell" :key="celldata">
{{ celldata.value }}
</td>
</template>
</tr>
</table>
But this shows nothing, the fields are just empty. What am I doing wrong?