I want to make that table in example photo.
I want to connect with row using by rowspan and made codes. But it didn't work, and browser displayed an error occurred. first of all, my sample data is below.
export const dummyCssTest = [
{
id:"1",
name:"a",
sub:[
{id:"1#1",name:"b"},
{id:"1#2",name:"c"},
]
},
{
id:"2",
name:"d",
sub:[
{id:"2#1",name:"e"},
{id:"2#2",name:"f"},
{id:"2#3",name:"g"},
]
}
]
if sub's id includes same number as main's id like "1", "2" in that case, name's row connect with number of sub's array length. So I made code below. My code is written by TypeScript and framework is Nuxt.js and Vuetify.js. Could you advise me, please?
<template>
<div>
<v-simple-table dense>
<thead>
<tr>
<th class="blue lighten-5">name</th>
<th class="blue lighten-5">sub_name</th>
</tr>
</thead>
<tbody>
<tr v-for="item in items" :key="item.id">
<td :rowspan="[sub.length]">{{item.name}}</td>
<td>{{item.sub[sub.length].name}}</td>
</tr>
</tbody>
</v-simple-table>
</div>
</template>
<script lang="ts">
import { Component, Vue} from 'nuxt-property-decorator'
import { dummyCssTest } from "~/store/dummy";
@Component({})
export default class extends Vue{
items:any=[]
mounted(){
this.items = dummyCssTest
}
}
</script>
<style lang="scss" scoped>
</style
