【问题标题】:How to show bootstrap modal dialog in vue js?如何在 vue js 中显示引导模式对话框?
【发布时间】:2018-04-03 18:31:04
【问题描述】:

我一直在尝试使用 bootstrap 和 vue js 显示模态对话框。我想在用户成功注册后显示对话框。

<div>
....
    <div class="modal fade" v-if="isEnabled">
      <div class="modal-dialog" role="dialog">
        <div class="modal-content">
          <div class="modal-header">
            <h5 class="modal-title">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">
            <p>Modal body text goes here.</p>
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-primary">Save changes</button>
            <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
          </div>
        </div>
      </div>
    </div>
....
</div>

但无法显示对话框。谁能帮我做这件事?

【问题讨论】:

标签: php html twitter-bootstrap vue.js


【解决方案1】:

例如:

如果你想在点击按钮上显示模态框然后使用

<button type="button" data-toggle="modal" data-target="#myModal">Open Modal</button>

如果您想在任何过程完成后打开模型框,请使用

$('#modal').modal('show');

"#myModal" 是您要显示的模态框的 ID。

更多信息https://www.w3schools.com/bootstrap/bootstrap_modal.asp

【讨论】:

    【解决方案2】:

    模态组件由jQuery管理,你必须使用jquery打开你的模态。

    我也需要你的Vue代码帮助你,如果是注册用户的ajax请求,等待成功回调进行

    $('#modal').modal('show') 
    

    如果是同步过程,在你的Vue实例的mounted方法中调用modal。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-24
      • 2013-08-15
      • 2021-12-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多