How to click a button in one component to hide a panel or control in another component in vue.

for example: there are two components on the page: a div B is hidden or displayed after a button is clicked on the A component.

Apr.19,2021

first of all, components An and B can pass values to each other between the parent and child components of page P
page P <-(showFlag)-> component A
page P <-(showFlag)-> component B

Page P sets a common variable showFlag, to pass to A, and A component internally modifies showFlag, to be passed to Page P by Synchronize.
component B receives a showFlag value to hide div


B components use v-show to control with a value, change this value after clicking the button on A


1, use vuex
2, use eventbus
3, and pass

through their parent components.
Menu