So I am trying to create a re-usable modal component. How can I acctually pass the toggleModal v-if thing to be triggered from outside the component? Also, I do not want a situation, where I got 2 modals in one components, and by triggering one, it opens all of them instead of only the one I clicked on. How should I approach this?
<div class="modal" v-if="toggleModal">
..content
</div>
props: {
title: {
type: String,
default: 'Title',
},
},
setup() {
let toggleModal = ref(true)
return { toggleModal }
},