rankinglist shows data from database

This commit is contained in:
Katharina Will 2019-04-09 16:20:07 +02:00
parent 7613fee705
commit 2bd3d36c14

View File

@ -22,10 +22,10 @@
<q-tab-panels v-model="tab" animated swipeable class="col">
<q-tab-panel name="solo" class="q-pa-md fit">
<q-list>
<q-card class="q-mb-md" v-for="user in users" :key="user.id">
<q-card class="q-mb-md" v-for="(user,index) in rankinglist" :key="user.id">
<q-item class="q-pr-sm ">
<q-item-section>
<q-item-label overline><a class="text-black" style="text-decoration: none"><span>{{user.username}}</span></a></q-item-label>
<q-item-label><a class="text-black" style="text-decoration: none"><span>{{index+1}}. {{user.username}}</span></a></q-item-label>
</q-item-section>
<q-item-section side>
<span class="text-grey">{{user.rankingPointsSum}} Punkte </span>
@ -69,24 +69,19 @@
data() {
return {
tab: 'solo',
rankinglist: [],
users: [{
username: "CacherA", id: "123", rankingPointsSum: "15"
},
{
username: "CacherB", id: "124", rankingPointsSum: "20"
}]
rankinglist: []
}
},
created: function() {
console.log("created(): " + this.rankinglist);
// this.fetchRankinglist();
this.fetchRankinglist();
},
methods: {
fetchRankinglist() {
this.$axios.get('http://localhost:8080/api/getRankingList')
.then((response) => {
console.log("Rankinglist: " + this.rankinglist);
console.log("Rankinglist: ");
console.log(response.data);
this.rankinglist = response.data;
})
}