Bootstrap Vue从模态主体中删除填充

时间:2019-03-27 09:53:00

标签: bootstrap-modal bootstrap-vue

如何删除模态身体填充物?我正在使用BoostrapVue

 <b-modal
  v-model="show"
  title="Modal Variants">

  <b-container fluid>
  </b-container>

  <div slot="modal-footer" class="w-100">
    <b-button size="sm" class="float-right" variant="primary" @click="show=false">Close</b-button>
  </div>
</b-modal>

2 个答案:

答案 0 :(得分:1)

您可以提供自己的类,以通过body-class属性删除正文填充 (或使用引导p-0类)。

new Vue({
  el: '#app',
  mounted () {
    this.$refs.modal.show()
  }
})
<link type="text/css" rel="stylesheet" href="//unpkg.com/bootstrap/dist/css/bootstrap.min.css" />
<script src="//unpkg.com/@babel/polyfill@latest/dist/polyfill.min.js"></script>
<script src="//unpkg.com/vue@latest/dist/vue.min.js"></script>
<script src="//unpkg.com/bootstrap-vue@latest/dist/bootstrap-vue.min.js"></script>

<div id='app'>
  <div>
    <b-modal ref="modal" id="modal1" title="BootstrapVue" body-class="p-0">
      <container fluid>
        content
      </container>
      <div slot="modal-footer">
        <b-button size="sm" class="float-right" variant="primary">Close</b-button>
      </div>
    </b-modal>
  </div>
</div>

答案 1 :(得分:-2)

只放

.modal  {
  padding: 0 !important;
}