Created
September 25, 2018 17:14
-
-
Save jonathanharrell/2ac4ea78bf8daf34bead57ec277fdf84 to your computer and use it in GitHub Desktop.
AccordionHeader Component Using Provide/Inject
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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