-
Notifications
You must be signed in to change notification settings - Fork 0
/
named_slot.html
54 lines (48 loc) · 1.43 KB
/
named_slot.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
51
52
53
54
<!DOCTYPE html>
<html>
<head>
<title>Named Slot in Nutshell | Vue 2</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/css/bulma.min.css">
</head>
<body>
<div id="root">
<modal>
<template slot="header">Modal Title</template>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Cupiditate eos, aut fugit sequi placeat veniam labore, quibusdam odit voluptate cumque nisi explicabo maiores commodi enim nulla illo maxime in sed.
<template slot="footer">
<button class="button is-success">Save changes</button>
<button class="button">Cancel</button>
</template>
</modal>
</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-card">
<header class="modal-card-head">
<p class="modal-card-title">
<slot name="header"></slot>
</p>
<button class="delete" aria-label="close"></button>
</header>
<section class="modal-card-body">
<slot>Default Content......</slot>
</section>
<footer class="modal-card-foot">
<slot name="footer">
<button class="button is-success">Okay</button>
</slot>
</footer>
</div>
</div>
`
});
new Vue({
el: '#root'
});
</script>
</body>
</html>