황성연

update

1 module.exports = { 1 module.exports = {
2 - root: true, 2 + root: false,
3 env: { 3 env: {
4 node: true 4 node: true
5 }, 5 },
......
This diff could not be displayed because it is too large.
1 <template> 1 <template>
2 <div> 2 <div>
3 - <home></home> 3 + <router-view></router-view>
4 </div> 4 </div>
5 </template> 5 </template>
6 6
7 <script> 7 <script>
8 -import home from './views/home'; 8 +export default {};
9 -export default {
10 - components: {
11 - home,
12 - },
13 -};
14 </script> 9 </script>
15 10
16 <style></style> 11 <style></style>
......
...@@ -9,10 +9,14 @@ const routes = [ ...@@ -9,10 +9,14 @@ const routes = [
9 name: 'Home', 9 name: 'Home',
10 component: () => import('../views/home'), 10 component: () => import('../views/home'),
11 }, 11 },
12 + {
13 + path: '/search/:id',
14 + component: () => import('../views/search'),
15 + },
12 ]; 16 ];
13 17
14 const router = new VueRouter({ 18 const router = new VueRouter({
15 - mode: 'history', 19 + mode: 'hash',
16 base: process.env.BASE_URL, 20 base: process.env.BASE_URL,
17 routes, 21 routes,
18 }); 22 });
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
42 </template> 42 </template>
43 43
44 <script> 44 <script>
45 -import { mainData, searchUser, spectatorData, matchData } from '../api/index'; 45 +import mainData from '../api/index';
46 export default { 46 export default {
47 data() { 47 data() {
48 return { 48 return {
...@@ -54,21 +54,7 @@ export default { ...@@ -54,21 +54,7 @@ export default {
54 }, 54 },
55 methods: { 55 methods: {
56 async searchUser() { 56 async searchUser() {
57 - try { 57 + this.$router.push('/search/' + this.search);
58 - const userId = this.search;
59 - const response = await searchUser(userId);
60 - console.log(response.data);
61 - if (response.status == 200) {
62 - const response2 = await spectatorData(userId);
63 - console.log(response2.data);
64 - const response3 = await matchData(userId);
65 - console.log(response3.data);
66 - this.$store.commit('setSpecTator', response2.data);
67 - this.$store.commit('setMatchData', response3.data);
68 - }
69 - } catch (error) {
70 - console.log('에러');
71 - }
72 }, 58 },
73 async fetchdata() { 59 async fetchdata() {
74 try { 60 try {
......
1 +<template>
2 + <div class="container">
3 + <div class="center">
4 + <img
5 + src="../../public/lolinfologo.png"
6 + alt="logo"
7 + width="300,"
8 + height="300"
9 + />
10 + </div>
11 + <div class="center2">
12 + <form>
13 + <input type="text" v-model="search" placeholder="Search" autofocus />
14 + <button v-show="search.length" @click.prevent="searchUser">
15 + Search
16 + </button>
17 + </form>
18 + </div>
19 + <div id="nav">
20 + <ul class="lot">
21 +
22 + <li
23 + v-for="(item, index) in this.$store.getters.lotationChampList"
24 + :key="index"
25 + >
26 + <img :src="item" alt="챔피언" width="50," height="50" />
27 + </li>
28 + </ul>
29 + </div>
30 + <div>
31 + <ul>
32 + 초보자 추천 리스트
33 + <li
34 + v-for="(item, index) in this.$store.getters.begChampList"
35 + :key="index"
36 + >
37 + <img :src="item" alt="" width="50," height="50" />
38 + </li>
39 + </ul>
40 + </div>
41 + </div>
42 +</template>
43 +
44 +<script>
45 +import { mainData, searchUser, spectatorData, matchData } from '../api/index';
46 +export default {
47 + data() {
48 + return {
49 + search: '',
50 + };
51 + },
52 + created() {
53 + this.fetchdata();
54 + },
55 + methods: {
56 + async searchUser() {
57 + this.$router.push('/search/' + this.search);
58 + },
59 + async fetchdata() {
60 + try {
61 + const response = await mainData();
62 + this.$store.commit('setlotationChamp', response.data.c_rotation);
63 + this.$store.commit('setbegChamp', response.data.c_rotation_newbie);
64 + console.log(response.data);
65 + } catch (error) {
66 + console.log('에러');
67 + }
68 +
69 + try {
70 + const userId = this.$route.params.id;
71 + const response = await searchUser(userId);
72 + console.log(response.data);
73 + if (response.status == 200) {
74 + const response2 = await spectatorData(userId);
75 + console.log(response2.data);
76 + const response3 = await matchData(userId);
77 + console.log(response3.data);
78 + this.$store.commit('setSpecTator', response2.data);
79 + this.$store.commit('setMatchData', response3.data);
80 + }
81 + } catch (error) {
82 + console.log('에러');
83 + }
84 + },
85 + },
86 +};
87 +</script>
88 +
89 +<style scoped>
90 +.center {
91 + width: 100vw;
92 + height: 50vh;
93 + font-weight: bolder;
94 + display: flex;
95 + align-items: center;
96 + justify-content: space-around;
97 +}
98 +.center2 {
99 + width: 100vw;
100 + height: 2vh;
101 + display: flex;
102 + align-items: center;
103 + justify-content: space-around;
104 +}
105 +.lot {
106 + float: left;
107 +}
108 +</style>