home.vue
1.8 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<template>
<div class="container">
<div class="center">
<img
src="../../public/lolinfologo.png"
alt="logo"
width="300,"
height="300"
/>
</div>
<div class="center2">
<form>
<input type="text" v-model="search" placeholder="Search" autofocus />
<button v-show="search.length" @click.prevent="searchUser">
Search
</button>
</form>
</div>
<div id="nav">
<ul class="lot">
금주의 로테이션 챔피언
<li
v-for="(item, index) in this.$store.getters.lotationChampList"
:key="index"
>
<img :src="item" alt="챔피언" width="50," height="50" />
</li>
</ul>
</div>
<div>
<ul>
초보자 추천 리스트
<li
v-for="(item, index) in this.$store.getters.begChampList"
:key="index"
>
<img :src="item" alt="" width="50," height="50" />
</li>
</ul>
</div>
</div>
</template>
<script>
import mainData from '../api/index';
export default {
data() {
return {
search: '',
};
},
created() {
this.fetchdata();
},
methods: {
async searchUser() {
this.$router.push('/search/' + this.search);
},
async fetchdata() {
try {
const response = await mainData();
this.$store.commit('setlotationChamp', response.data.c_rotation);
this.$store.commit('setbegChamp', response.data.c_rotation_newbie);
console.log(response.data);
} catch (error) {
console.log('에러');
}
},
},
};
</script>
<style scoped>
.center {
width: 100vw;
height: 50vh;
font-weight: bolder;
display: flex;
align-items: center;
justify-content: space-around;
}
.center2 {
width: 100vw;
height: 2vh;
display: flex;
align-items: center;
justify-content: space-around;
}
.lot {
float: left;
}
</style>