-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path10. computed props.html
50 lines (35 loc) · 1 KB
/
10. computed props.html
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
<!DOCTYPE html>
<html>
<head>
<title>Computed props</title>
<script type="text/javascript" src="https://vuejs.org/js/vue.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
</head>
<body>
<div id="my-app" class="container pt-4 d-flex flex-row">
<computed inline-template>
<div class="alert alert-info">
Hello {{ this.fullName }}
</div>
</computed>
</div>
<script type="text/javascript">
Vue.component('computed', {
data() {
return {
firstName: 'Garry',
lastName: 'Barlow'
}
},
computed: {
fullName() {
return `${this.firstName} ${this.lastName}`;
}
}
})
new Vue({
el: '#my-app'
})
</script>
</body>
</html>