jgravois
2 years ago
56
2
Vue

Struggling with Child/Parent Communication (in Vue.js that is)

Posted 2 years ago by jgravois

I have a table and in each row there are icons for several trade references for each company. Clicking this icon pops up a modal. I really want to make the modal a child component since there is quite a bit of functionality.

<div class="modal" :class="{'is-active': showTraderModal}" @closeModal="toggleTradeModal">
    <tr-modal></tr-modal>
</div>

in the child component I have

toggleTradeModal() {  this.$emit('closeModal’); }

and in the parent

toggleTradeModal() {  this.showTraderModal = !this.showTraderModal; },

However, this never fires and the modal never closes. Is that not correct???

Please sign in or create an account to participate in this conversation.