in my project i have data from JSON API and i wanted to view the index of each data.. for example, below i viewed the floors from array index numbered from 0 to 22 but when it comes to view flats in each floor i couldn't get the array index, below for floor 0 i have 6 arrays for flats until 22 all have array(6) of flats so i wanted to view them from 0 to 6 for each floor but i couldn't. can someone help in this please?
https://i.stack.imgur.com/aWzCj.png
<template>
<b-card no-body class="bg-default shadow">
<b-table-simple responsive>
<b-thead>
<b-tr>
<b-th sticky-column>flats </b-th>
<b-th > //here i want to show the indexes of array(6) in provided image
</b-th>
</b-tr>
</b-thead>
<b-tbody >
<b-tr v-for="(floor,floor_index) in Building.floors"
:key="floor_index">
<b-th sticky-column></b-th> //here i viewed from 0 to 22 floors
<b-td>Cell</b-td>
</b-tr>
</b-tbody>
</b-table-simple>
</b-card>
</template>
<script>
import projects from './../projects'
import { Table, TableColumn} from 'element-ui'
import BuildingsService from "@/services/ApiService"
export default {
name: 'light-table',
components: {
},
data() {
return {
Flats:[],
index:0,
Floors:[],
Building:[],
NoOfFloors: [],
projects,
currentPage: 1
};
},
mounted: function(){
BuildingsService.getOneBuilding(`${this.$route.params.id}`).then((response) => {
this.Building = response.data.response;
this.NoOfFloors = this.Building.floors;
console.log(this.Building.floors,"single");
});
BuildingsService.getFlats().then((response) => {
this.Flats = response.data.response;
});
}
}
</script>
Comments
Post a Comment