0👍
✅
I have edited your code here, to make it work. However, you’ll need to create a “close” button in the modal itself, to toggle isModalLoginVisible
back to false
. You can pass the same click handler to the Modal.vue
to make the close button work.
Both of your components should be called in a common component, such as App.vue
. Create a click handler in the App.vue
component and pass the handler as a prop to the Header.vue
component. In the Header.vue
component, pass the click handler to the button @click
property. The click handler, in the App.vue
component, will toggle a flag which will decide whether the Modal.vue
component should be visible or not, using the v-if
directive.
Source:stackexchange.com