-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathexample_06.html
More file actions
63 lines (52 loc) · 2.02 KB
/
example_06.html
File metadata and controls
63 lines (52 loc) · 2.02 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
<html>
<head>
<title>Vue.js Example 06</title>
<link rel="stylesheet" type="text/css" href="bootstrap-3.3.7-dist/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="styles/site.css">
<script src="lib/vue@2.2.1.js"></script>
</head>
<body>
<div id="app">
<div class="panel-group">
<div class="panel panel-default card">
<div class="panel-heading">
<h2>We Serve:</h2>
</div>
<div class="panel-body">
<pizza-item type="margherita"></pizza-item>
</div>
</div>
</div>
</div>
<script>
/**
Components are a reusable building blocks.
A component is constructed by:
- Properties: a way to get information in
- Template: a way to display data
- Events: a way of exposing data
It gives us a way of splitting the Application into small
bits and encapsulate concerns, meaning: each component takes care of its own domain.
Eg: Cart component
- Will take care of displaying a list of items in our cart
- Will take care of displaying total price.
- Has a button to go to payment
So in that way we can use Cart in different parts of our application:
- Main page should display the cart
- List of products should display the cart
And we know that it will always act the same.
*/
Vue.component('pizza-item', {
props: ['type'],
template: '<div> {{ type }} </div>'
});
new Vue({
el: '#app'
});
</script>
</body>
</html>
<!--
Example 06:
Create and show a list of 3 pizzas.
-->