DetailPage.vue
1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<template>
<div>
<h1>{{ $route.params.userId }}</h1>
<h1>{{ userId }}</h1>
<h1>{{ userPk }}</h1>
<span></span>
<ul>
<li v-for="avg in average">
<h1>id : {{ avg.id }}</h1>
<h1>winrate : {{ avg.winrate }}</h1>
</li>
</ul>
</div>
</template>
<script>
export default {
name: 'DetailPage',
data () {
return {
userId: this.$route.params.userId,
userPk: null,
average: [],
}
},
created () {
//this.userId = $route.params.userId
//this.axios.post('http://127.0.0.1:8000/GameData/search/', {'game_id': "laurelwoods"}, {
// headers: { 'Content-Type': 'application/json'}
//})
this.axios.get('http://127.0.0.1:8000/GameData/search/', {
params: { game_id: 'laurelwoods' }
})
.then((response) => {
this.userPk = response.data.id;
this.axios.get('http://127.0.0.1:8000/GameData/' + this.userPk + '/average/')
.then((response) => {
this.average = response.data;
})
})
}
}
</script>
<style scoped>
</style>