如何隐藏 b-modal来自外部的组件?
最佳答案
在你的<template>
:
<b-button v-b-modal="'myModalId'">
Open Modal
</b-button>
<b-modal :id="myModalId">
<div>
Ami du soir, bonsoir !
</div>
<b-btn @click="hideModal(id)">Close Me</b-btn>
</b-modal>
在你的<script>
导出默认{}段落:
methods: {
hideModal (id) {
this.$root.$emit('bv::hide::modal',id)
}
}
更多详情 here .
关于vue.js - 从外部关闭 b-modal BootrstrapVue,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43210041/