Created
December 30, 2021 15:35
-
-
Save argahsuknesib/a52266103bbb647aae361cbb5608c791 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div class="heater"> | |
<table class="heater"> | |
<thead> | |
<tr> | |
<th v-for="key in columns" v-bind:key="key"> | |
{{ key }} | |
</th> | |
</tr> | |
</thead> | |
<tbody> | |
<tr v-for="values in this.heaters" v-bind:key="values.id"> | |
<td>{{ values.id }}</td> | |
<td>{{ values.name }}</td> | |
<td>{{ values.power }}</td> | |
<td>{{ values.heaterStatus }}</td> | |
<td>{{values.roomName}}</td> | |
<td>{{values.room}}</td> | |
<td>{{values.roomId}}</td> | |
</tr> | |
</tbody> | |
</table> | |
</div> | |
</template> | |
<script> | |
import axios from "axios"; | |
import { API_KUSHAGRA } from "../config"; | |
export default { | |
name: "heater", | |
data() { | |
return { | |
heaters: [], | |
columns: [ | |
"ID", | |
"Name", | |
"Power", | |
"Heater Status", | |
"Room Name", | |
"Room", | |
"Room ID" | |
], | |
} | |
}, | |
created : async function(){ | |
let response = await axios.get(`${API_KUSHAGRA}/api/heater`); | |
let heaters = response.data; | |
this.heaters = heaters; | |
} | |
}; | |
</script> | |
<style> | |
@import "table.css"; | |
.clickable { | |
cursor: pointer; | |
} | |
td { | |
padding: 10px; | |
} | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment