-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstep17_componentTest.html
More file actions
107 lines (87 loc) · 3.04 KB
/
step17_componentTest.html
File metadata and controls
107 lines (87 loc) · 3.04 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<style>
#list {
width: 600px;
border: 1px solid black;
border-collapse: collapse;
}
#list td,
th {
border: 1px solid black;
text-align: center;
}
#list>thead>tr {
color: yellow;
background-color: rgb(30, 168, 30);
}
</style>
</head>
<body>
<h3>component review</h3>
<br><hr><br>
1. 제공받은 데이터로 제시된 이미지 처럼 동일한 결과가 출력되게 완성하기 <br>
2. 재사용성을 고려하여 component 구조로 구성하기 <br>
3. 제공받은 서로 다른 데이터로 동일한 UI 구성을 하려면 어떻게 설계를 하면 좋을지 고민해 보기<br>
4. 중복 UI 부분은 template tag로 구성하기 <br>
<img src="images/step17_custlist.jpg" width="50%"> <br>
<br><hr><br>
<template id="listTemplate">
<div>
<table id="list">
<thead>
<tr>
<th>번호</th>
<th>이름</th>
<th>전화번호</th>
<th>주소</th>
</tr>
</thead>
<tbody id="contacts">
<tr v-for="contact in contacts">
<td>{{contact.no}}</td>
<td>{{contact.name}}</td>
<td>{{contact.tel}}</td>
<td>{{contact.address}}</td>
</tr>
</tbody>
</table>
</div>
</template>
<div id="app">
<h3>고객 명단</h3>
<hr>
<h3>1차 고객 : 1월 1~3일</h3>
<hi :contacts="list1"></hi>
<h3>2차 고객 : 1월 13~15일</h3>
<hi v-bind:contacts="list2"></hi>
</div>
<script>
// ???
Vue.component("hi",{
template:"#listTemplate",
props:['contacts']
});
var vm = new Vue({
el: "#app",
data: {
list1: [ //1차 고객 명단
{ "no": 97, "name": "유재석", "tel": "010-3456-8296", "address": "서울시" },
{ "no": 96, "name": "신동엽", "tel": "010-3456-8295", "address": "서울시" },
{ "no": 95, "name": "이승기", "tel": "010-3456-8294", "address": "서울시" }
],
list2: [ //2차 고객 명단
{ "no": 82, "name": "김혜수", "tel": "010-3456-8281", "address": "서울시" },
{ "no": 81, "name": "전지현", "tel": "010-3456-8280", "address": "서울시" }
]
}
});
</script>
</body>
</html>