1
I have a component in which in it is just a modal which has the following header:
<b-modal id="mdgroup" ref="mdgroup" size="lg" title="Nova categoria de receita" @ok="save" ok-title="Salvar" cancel-title="Cancelar">
In the parent component, where this modal is I would like to call it by clicking on a kind of button:
<a href="#" v-on:click="showModal()"><icon name="eye" scale="1.6"></icon></a>
I can call her good, like this:
showModal(){
this.$root.$emit('bv::show::modal','mdgroup')
}
But the question is, how can I pass some value as property to that modal? There is another way to call it without having to issue event?
If the modal is a component that is within that component use
props
its purpose is for this, theemit
is to notify the parent component that an event has occurred in the child component.– Marconi
Ta, but how would I call this component when clicking the button?
– SkullFire
For example, assuming you have a component with order details. You could pass a boolean variable to this component, this would make the modal opening and closing control, example
<detalhes-pedido
 :opened="opened"
 />
(That goes in the parent component). When you click on a button that should open the modal just change this variable offalse
fortrue
. In the child component you should receive this variable with a props like this:props: ['opened'],
– Marconi