-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.html
75 lines (72 loc) · 2.67 KB
/
index.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/css/bulma.min.css" />
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<!-- <link rel="stylesheet" href="/dist/entry.css">
<script src="/dist/entry.js"></script> -->
<script src="./src/entry.js"></script>
<title>Test Bulma Accordion</title>
</head>
<body>
<div id="app">
<p class="title is-3">
Basic Example
</p>
<button class="button is-primary" @click="addItem">add</button>
<bulma-accordion :initial-open-items="[1,2]" dropdown>
<!-- The wrapper component for all the items -->
<bulma-accordion-item>
<h4 slot="title">Just a title</h4>
</bulma-accordion-item>
<!-- add as many of these items as you need - fill them with content via the slots -->
<bulma-accordion-item v-for="(i, idx) in items" :key="i.title">
<h4 slot="title">{{ i.title }}</h4>
<p slot="content">
{{ i.content }}
<button class="button is-danger" @click="removeItem(idx)">
Remove
</button>
</p>
</bulma-accordion-item>
<bulma-accordion-item>
<h4 slot="title">Auto-Resize!</h4>
<div slot="content">
<p v-for="(c, idx) in body_content" :key="idx" class="body-content">
{{ c }}
</p>
</div>
<button class="button is-primary" slot="footer" @click="addContent">
Add content...
</button>
</bulma-accordion-item>
</bulma-accordion :initial-open-items="[1,2]" dropdown>
</div>
<script>
const app = new Vue({
el: "#app",
data: {
body_content: ["Content"],
items: [{ title: "abc", content: "123" }]
},
methods: {
addContent() {
this.body_content.push("More Content");
},
addItem() {
this.items.push({
title: Math.random().toFixed(5),
content: Math.random()
});
},
removeItem(idx) {
this.items.splice(idx, 1);
}
}
});
</script>
</body>
</html>