简体   繁体   English

在 b-modal 中使用 b-overlay 时,模态主体不可见

[英]When using b-overlay in b-modal the modal body is not visible

I am using Vue Bootstrap and when I add b-overlay with no-wrap prop in b-modal the modal body is not visible even if the overlay is not active.我正在使用 Vue Bootstrap,当我在 b-modal 中添加带有 no-wrap 道具的 b-overlay 时,即使覆盖未激活,模态主体也不可见。 Please see the example请看例子

https://codesandbox.io/s/friendly-worker-evcyd https://codesandbox.io/s/friendly-worker-evcyd

I can use it without no-wrap prop but this way the modal footer and header are not overlaid我可以在没有 no-wrap 道具的情况下使用它,但是这样模态页脚和 header 就不会被覆盖

That's because you're using the no-wrap property, which disabled the usage of the default slot in <b-overlay> .那是因为您使用的是no-wrap属性,它禁用了<b-overlay>中默认插槽的使用。

You can read more here: https://bootstrap-vue.org/docs/components/overlay#non-wrapping-mode你可以在这里阅读更多: https://bootstrap-vue.org/docs/components/overlay#non-wrapping-mode

By default, wraps the content of the default slot.默认情况下,包装默认插槽的内容。 In some cases you may want to obscure a parent container.在某些情况下,您可能希望隐藏父容器。 Use the no-wrap prop to disable rendering of the wrapping (and ignore the default slot).使用 no-wrap 属性禁用包装的渲染(并忽略默认插槽)。

If you need to use no-wrap , you need to place the content you want outside of <b-overlay> .如果你需要使用no-wrap ,你需要将你想要的内容放在<b-overlay>之外。

<b-modal>
  <b-overlay no-wrap>
    <template #overlay>
      Overlay content here
    </template>
  </b-overlay>

  <div>Modal content</div>
</b-modal>

As mentioned here , you can add body-class="position-static" on b-modal and rounded prop enabled.如此所述,您可以在 b-modal 和启用的 rounded 道具上添加 body-class="position-static"。 This will make the entire b-modal covered with overlay.这将使整个 b-modal 覆盖覆盖。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM