【发布时间】:2021-09-24 08:16:15
【问题描述】:
我想在组件创建但没有发生时调用 b-modal。然而,在单击按钮时,会调用模态。我们该如何解决这个问题?
<template>
<b-container>
<button @click="$bvModal.show('modal1')">Show</button>
<b-modal id="modal1" title="Loading" hide-footer no-close-on-backdrop>
<p>Preparing the Application, Please wait</p>
</b-modal>
</b-container>
</template>
<script>
export default {
data() {
return {};
},
created() {
this.showModal();
},
methods: {
showModal() {
this.$bvModal.show("modal1");
},
},
};
</script>
【问题讨论】:
-
我不知道为什么,但是我们这里的 cmets 消失了。无论如何,如果你觉得my answer 帮助了你,你可以accept my answer :)
标签: vue.js vuejs2 bootstrap-modal bootstrap-vue