首页 > 解决方案 > BootstrapDailog 在带有 Jquery 3.3.1 的 Bootstrap4 中不起作用

问题描述

我在调用 BootstrapDialog.confirm 时将 BootstrapDialog 与 Bootstrap4 和 Jquery3.3.1 一起使用,然后它会在旧版本的 chrome 中抛出错误“Uncaught TypeError: Object.keys called on non-object”。我还添加了 Jquery-migrate3.0.0 但是没用。但是 BootstrapDialog 与 Bootstrap3 和 jquery-2.2.3 一起工作得很好

标签: bootstrap-4android-webviewjquery-3jquery-migratebootstrap-dialog

解决方案


Bootstrap 4 Dialog 或 Modals 有点奇怪。但是试试这个解决方案,希望它对你有用。

    <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalCenter">
  Launch demo modal
</button>

<div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalCenterTitle">Modal title</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>

推荐阅读