Files
SNCTF-theme/src/components/socre.vue
2022-06-27 20:27:32 +08:00

51 lines
1.1 KiB
Vue

<template>
<!-- <div id="myChart"></div>-->
<h1 class="title">排名</h1>
<el-row class="row-bg" justify="center">
<el-col :span="16">
<el-table :data="tableData" style="width: 100%" stripe :row-class-name="tableRowClassName">
<el-table-column prop="rank" label="Ranking" width="180" />
<el-table-column prop="username" label="User" width="180" />
<el-table-column prop="score" label="Score" />
</el-table>
</el-col>
</el-row>
</template>
<script>
import axios from "axios";
export default {
data(){
return{
tableData:[],
}
},
mounted() {
axios.get('/api/v1/score').then(res => {
if (res.data.code === 200) {
console.log(res.data.data);
this.tableData = res.data.data;
this.tableData.forEach(function(item,index){
item.rank = index+1;
})
}
})
}
}
</script>
<style>
.title{
display: flex;
justify-content: center;
color: #dddddd;
}
.el-table .warning-row {
--el-table-tr-bg-color: var(--el-color-warning-light-9);
}
.el-table .success-row {
--el-table-tr-bg-color: var(--el-color-success-light-9);
}
</style>