@@ -3,6 +3,10 @@ Simple accordion menu component for Vuejs
33
44[ Check it out live!] ( http://zeratulmdq.github.io/vue-accordion/ )
55
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+
610## Install
711
812#### NPM / Yarn
@@ -35,11 +39,11 @@ Then register the component:
3539
3640``` html
3741<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+ });
4347 </script >
4448```
4549
@@ -48,10 +52,7 @@ Then register the component:
4852Simply use it like so:
4953
5054``` 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 >
5556```
5657
5758## Structure
@@ -60,41 +61,41 @@ Once the accordion has been rendered, it'll create the following structure:
6061
6162```` html
6263<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 >
8081</div >
8182````
8283
8384All CSS is based uppon this structure.
8485
8586``` css
8687.vue-accordion {
87- ...
88+ ...
8889}
8990
9091.vue-accordion ul {
91- ...
92+ ...
9293}
9394
9495...
9596
9697.vue-accordion ul li a h2 {
97- ...
98+ ...
9899}
99100```
100101
@@ -104,13 +105,15 @@ If you want to modify the styling, take a look at the `accordionClass` and `styl
104105
105106##### items
106107Mandatory. 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+ ```
114117
115118Take 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.
116119
@@ -122,30 +125,30 @@ Optional. An object whose keys are other objects containing specific CSS propert
122125
123126``` js
124127{
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+ }
149152}
150153```
151154
0 commit comments