I have a button that should open a modal from a child, that adds a new customer.
It works if I have the code just in parent, but I try to implement this in a child.
Parent
<b-button @click="openModal">Add new customer</b-button>
<add-new-customer ref="modal" v-if="addCustomer"></add-new-customer>
openModal() {
this.$refs.modal.openModalCh()
},
Child
<b-modal
id="modal-prevent-closing"
ref="modal"
title="Add new customer"
@ok="addCustomer"
>
...code..
</b-modal>
<add-new-customer ref="modal" v-if="addCustomer" @added="onAddCustomer"></add-new-customer>
addCustomer() {
..code for post a new customer..
}
openModal() {
this.$refs.modal.openModalCh()
},