-
Notifications
You must be signed in to change notification settings - Fork 0
/
message_component.html
45 lines (39 loc) · 1.24 KB
/
message_component.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
<!DOCTYPE html>
<html>
<head>
<title>Custom Component | Vue 2</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.8.0/css/bulma.min.css">
<style type="text/css"> body { padding: 40px; } </style>
</head>
<body>
<div id="root">
<message title="Hello World!" body="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque risus mi, tempus quis placerat ut, porta nec nulla. Vestibulum rhoncus ac ex sit amet fringilla."> </message>
<message title="Complete the tasks" body="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque risus mi, tempus quis placerat ut, porta nec nulla. Vestibulum rhoncus ac ex sit amet fringilla."> </message>
</div>
<script src="https://unpkg.com/vue@2.1.3/dist/vue.js"></script>
<script type="text/javascript">
Vue.component('message', {
data() {
return {
isVisible: true
}
},
props: [ 'title', 'body' ],
template: `
<article class="message" v-show="isVisible">
<div class="message-header">
<p>{{ title }}</p>
<button class="delete" aria-label="delete" @click="isVisible = false"></button>
</div>
<div class="message-body">
{{ body }}
</div>
</article>
`,
});
new Vue({
el: '#root'
})
</script>
</body>
</html>