@@ -3,6 +3,10 @@ Simple accordion menu component for Vuejs
3
3
4
4
[ Check it out live!] ( http://zeratulmdq.github.io/vue-accordion/ )
5
5
6
+ ## Note
7
+
8
+ The API has changed. Check [ v0.0.3 documentation] ( /docs/0.0.3.md ) if you use the old version.
9
+
6
10
## Install
7
11
8
12
#### NPM / Yarn
@@ -35,11 +39,11 @@ Then register the component:
35
39
36
40
``` html
37
41
<script >
38
- Vue .component (' vue-accordion' , vueAccordion)
39
-
40
- var vm = new Vue ({
41
- ...
42
- });
42
+ Vue .component (' vue-accordion' , vueAccordion)
43
+
44
+ var vm = new Vue ({
45
+ ...
46
+ });
43
47
</script >
44
48
```
45
49
@@ -48,10 +52,7 @@ Then register the component:
48
52
Simply use it like so:
49
53
50
54
``` html
51
- <vue-accordion :items =" items"
52
- :accordionClass =" acClass"
53
- :styles =" styles" >
54
- </vue-accordion >
55
+ <vue-accordion :items =" items" :accordionClass =" acClass" :styles =" styles" ></vue-accordion >
55
56
```
56
57
57
58
## Structure
@@ -60,41 +61,41 @@ Once the accordion has been rendered, it'll create the following structure:
60
61
61
62
```` html
62
63
<div class =" vue-accordion" >
63
- <ul >
64
- <!-- First menu item-->
65
- <li >
66
- <a >
67
- <h2 >...</h2 >
68
- <p >...</p >
69
- </a >
70
- </li >
71
- <!-- Second menu item-->
72
- <li >
73
- <a >
74
- <h2 >...</h2 >
75
- <p >...</p >
76
- </a >
77
- </li >
78
- ...
79
- </ul >
64
+ <ul >
65
+ <!-- First menu item-->
66
+ <li >
67
+ <a >
68
+ <h2 >...</h2 >
69
+ <p >...</p >
70
+ </a >
71
+ </li >
72
+ <!-- Second menu item-->
73
+ <li >
74
+ <a >
75
+ <h2 >...</h2 >
76
+ <p >...</p >
77
+ </a >
78
+ </li >
79
+ ...
80
+ </ul >
80
81
</div >
81
82
````
82
83
83
84
All CSS is based uppon this structure.
84
85
85
86
``` css
86
87
.vue-accordion {
87
- ...
88
+ ...
88
89
}
89
90
90
91
.vue-accordion ul {
91
- ...
92
+ ...
92
93
}
93
94
94
95
...
95
96
96
97
.vue-accordion ul li a h2 {
97
- ...
98
+ ...
98
99
}
99
100
```
100
101
@@ -104,13 +105,15 @@ If you want to modify the styling, take a look at the `accordionClass` and `styl
104
105
105
106
##### items
106
107
Mandatory. An array of objects to create the panels inside the accordion. Each object must have this structure:
107
-
108
- {
109
- title: 'First',
110
- text: 'text',
111
- url: '#',
112
- image: '/images/one.jpg'
113
- }
108
+
109
+ ```
110
+ {
111
+ title: 'First',
112
+ text: 'text',
113
+ url: '#',
114
+ image: '/images/one.jpg'
115
+ }
116
+ ```
114
117
115
118
Take into consideration the width of the accordion and the images you use. If the image is shorter, you'll see a an awful grey background.
116
119
@@ -122,30 +125,30 @@ Optional. An object whose keys are other objects containing specific CSS propert
122
125
123
126
``` js
124
127
{
125
- // this will be bound to the style attribute of all `div`s inside the accordion
126
- div: {
127
- height: ' 350px'
128
- },
129
- // this will be bound to the style attribute of all `ul`s inside the accordion
130
- ul: {
131
- color: ' #F00'
132
- },
133
- // this will be bound to the style attribute of all `li`s inside the accordion
134
- li: {
135
- fontSize: ' 15px'
136
- },
137
- // this will be bound to the style attribute of all `a`s inside the accordion
138
- a: {
139
- padding: ' 30px'
140
- },
141
- // this will be bound to the style attribute of all `h2`s inside the accordion
142
- h2: {
143
- marginTop: ' 100px'
144
- },
145
- // this will be bound to the style attribute of all `p`s inside the accordion
146
- p: {
147
- textTransform: ' uppercase'
148
- }
128
+ // this will be bound to the style attribute of all `div`s inside the accordion
129
+ div: {
130
+ height: ' 350px'
131
+ },
132
+ // this will be bound to the style attribute of all `ul`s inside the accordion
133
+ ul: {
134
+ color: ' #F00'
135
+ },
136
+ // this will be bound to the style attribute of all `li`s inside the accordion
137
+ li: {
138
+ fontSize: ' 15px'
139
+ },
140
+ // this will be bound to the style attribute of all `a`s inside the accordion
141
+ a: {
142
+ padding: ' 30px'
143
+ },
144
+ // this will be bound to the style attribute of all `h2`s inside the accordion
145
+ h2: {
146
+ marginTop: ' 100px'
147
+ },
148
+ // this will be bound to the style attribute of all `p`s inside the accordion
149
+ p: {
150
+ textTransform: ' uppercase'
151
+ }
149
152
}
150
153
```
151
154
0 commit comments