Skip to content

How to Programmatically Control Accordion Open/Close State with External Props? #595

Answered by sadeghbarati
bjorne84 asked this question in Q&A
Discussion options

You must be logged in to vote

https://stackblitz.com/edit/dp1hww?file=src%2FApp.vue

You can use Checkbox @update:checked emit to control Accrodion component (controlled component)
If Checkbox and Accordion are not in the same Vue file you can use

  • some state management with refs
  • provide inject
  • pinia store

to communicate between these two components

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@bjorne84
Comment options

Answer selected by bjorne84
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants