-
Notifications
You must be signed in to change notification settings - Fork 0
/
modal_component.html
44 lines (41 loc) · 1.18 KB
/
modal_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
<!DOCTYPE html>
<html>
<head>
<title>Modal Custom Component | Vue 2</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/css/bulma.min.css">
<style type="text/css"> body { padding: 20px; } </style>
</head>
<body>
<div id="root">
<modal v-show="showModal" @close="showModal = false">
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Repellendus eos atque veritatis, tempore cupiditate, rerum quibusdam. Porro modi maiores quidem aspernatur eligendi, fugit nostrum ullam nobis iste ipsam ab consequatur.
</p>
</modal>
<button @click="showModal = true">Show Modal</button>
</div>
<script src="https://unpkg.com/[email protected]/dist/vue.js"></script>
<script type="text/javascript">
Vue.component('modal', {
template: `
<div class="modal is-active">
<div class="modal-background"></div>
<div class="modal-content">
<!-- Any other Bulma elements you want -->
<div class="box">
<slot></slot>
</div>
</div>
<button class="modal-close is-large" aria-label="close" @click="$emit('close')"></button>
</div>
`,
});
new Vue({
el: '#root',
data: {
showModal: false
}
})
</script>
</body>
</html>