vue-badger-accordion
Badger-Accordion Component for Vue 2.0
This package is a wrapper for the badger-accordion made by Stuart Nelson
Badger-Accordion-Repository:
https://github.com/stuartjnelson/badger-accordion
Installation
Install package
npm install vue-badger-accordion --save
Setup
Implement globally
VueVue
Implement locally
components: BadgerAccordion BadgerAccordionItem
Example
First Accordion Header First Accordion Content Second Accordion Header Second Accordion Content
Note: You can replace the template-tag with all regular html-tags, just remember to add the slot-parameter.
Options
Options can be implemented by component property "option".
...
A list of available options could be found in the badger-accordion repository
https://github.com/stuartjnelson/badger-accordion#options
Events
You can handle open/close-Events for each AccordionItem
First Accordion Header First Accordion Content
methods: ... { // Item opened } { // Item closed }
Thanks to elbojoloco for that change.
Custom state-indicators/-icons
By default the Accordion-Header shows an state-indicator (+/-). You can easily disable or replace them with images or your favorite icon-font by set the icon-property.
Set Icons - Basic
with font-library e.g. font-awesome
with images
Set Icons - Advanced
Sometimes you may want greater control of your the state icon renders. In this case you can pass a vue component in directly to the badger accordion:
const MyComponent = template: ` <span class="my-icon">{{ opened ? 'I am open' : ' I am closed' }}</span> ` props: opened: type: Boolean default: false components: BadgerAccodion BadgerAccordionItem { return iconComponent: MyComponent }
Disable Icons
Methods
All Methods of badger-accordion are also available. Just add a ref to you accordion and you can access them.
this$refsmyAccordion
A list of available methods could be found in the badger-accordion repository