Skip to content

Instantly share code, notes, and snippets.

@jonathanharrell
Created September 25, 2018 17:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonathanharrell/2ac4ea78bf8daf34bead57ec277fdf84 to your computer and use it in GitHub Desktop.
Save jonathanharrell/2ac4ea78bf8daf34bead57ec277fdf84 to your computer and use it in GitHub Desktop.
AccordionHeader Component Using Provide/Inject
Vue.component('accordion-header', {
inject: ['accordionItemState'],
template: `
<h2 class="accordion-header">
<button @click="accordionItemState.expanded = !accordionItemState.expanded">
{{ accordionItemState.expanded ? '▼' : '►' }}
<slot></slot>
</button>
</h2>
`
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment