I have a child component called Navbar
. A logout is an option in the Navbar.
<a @click="(event) => {event.preventDefault();}">
Logout
</a>
I have imported this Navbar
into my parent component called Home
. And in the Home
component, there is a div (a modal),
<div class="modal" v-if="modal">
And this modal will show only if the modal ref is true
.
<script setup>
import Navbar from './components/Navbar.vue';
import {ref} from 'vue';
const modal = ref(false);
</scipt>
My question is how to make this modal ref
value to true
when we click the logout
option in my Navbar
child component.
<a @click.prevent="emit('some-event')">
... that the parent can handle :<nav-bar@some-event="... do things in here">
– Pilcomayo