Bootstrap 4与远程Modal [英] Bootstrap 4 with remote Modal
问题描述
我无法使Modal在远程模式下使用新的Bootstrap发布版本:Bootstrap 4 alpha。它的工作原理与Bootstrap 3完美。与bootstrap 4我得到的弹出窗口,但模型体没有被加载。没有远程调用 myRemoteURL.do
加载模型体。
I can't make the Modal work in the remote mode with the new Twitter Bootstrap release : Bootstrap 4 alpha. It works perfectly fine with Bootstrap 3. With bootstrap 4 I am getting the popup window, but the model body is not getting loaded. There is no remote call being made to myRemoteURL.do
to load the model body.
代码:
<button type="button" data-toggle="modal" data-remote="myRemoteURL.do" data-target="#myModel">Open Model</button>
<!-- Model -->
<div class="modal fade" id="myModel" tabindex="-1"
role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h3 class="modal-title" id="myModalLabel">Model Title</h3>
</div>
<div class="modal-body">
<p>
<img alt="loading" src="resources/img/ajax-loader.gif">
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Submit</button>
</div>
</div>
</div>
</div>
推荐答案
发现问题:他们在引导过程中删除了远程选项4
远程:此选项自v3.3.0起已弃用,将在v4中移除。我们建议您改为使用客户端模板或数据绑定框架,或者自己调用jQuery.load。
remote : This option is deprecated since v3.3.0 and will be removed in v4. We recommend instead using client-side templating or a data binding framework, or calling jQuery.load yourself.
我使用JQuery来实现已移除的功能。
I used JQuery to implement this removed feature.
$('body').on('click', '[data-toggle="modal"]', function(){
$($(this).data("target")+' .modal-body').load($(this).data("remote"));
});
这篇关于Bootstrap 4与远程Modal的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!