how to open the modal from child component in vue jss code example
Example: boostrap vue open modal in child component
Parent.vue
<template>
<button @click="openModal()">Open Child Component</button>
<child-component-with-modal ref="childComponent">
</child-component-with-modal>
</template>
<script>
export default {
data() {..}
methods: {
openModal(){
this.$refs.childComponent.$children[0].show();
console.log(this.$refs.childComponent);
}
}
}
</script>
Single File Component Child.vue
<template>
<div>
...
</div>
<b-modal @ok="confirmed()" @cancel="canceled()" @close="canceled()">
</b-modal>
</template>
<script>
export default {
data() {..}
methods: {...}
}
</script>