语义UI模式不拒绝/或批准事件未触发

时间:2015-04-08 10:41:50

标签: javascript jquery html5 semantic-ui

我遇到了SemanticUI模态面板模块的问题,我已经设置了所有内容,但我不知道如何才能使onDeny / onApprove事件触发。 onShow和onVisible等其他事件正常启动而没有任何问题。此外,可关闭标志设置为false,但我仍然看到关闭按钮。

我的jquery监听器定义如下:

$('#btnReset').click(function(){
  $('#confirmModalPanel')
    .modal({
        closable  : false,
        onShow: function(){console.log('onShow');},
        onVisible: function(){console.log('onVisible');},
        onDeny: function(){console.log('onDeny');},
        onApprove: function(){console.log('onApprove');}
    })
    .modal('show');
});

这是jsfiddle link

1 个答案:

答案 0 :(得分:4)

显示关闭按钮,因为您在模态中添加了<i class="close icon"></i>,如果删除此元素,则不会显示关闭按钮。

closable属性不会以您期望的方式影响,closable:false使您的模态中的任何位置单击无效,因此模态不会隐藏,或者如果您设置{{1}然后单击你的模态使模态隐藏。

关于要在closable:true上添加onDeny/onApprove课程的火警ok课程,以及<div>上的cancel课程。所以使用:

<div>

而不是:

<div class="ui green ok basic inverted button"> // added "ok"
    <i class="checkmark icon"></i>
      DA
</div>
<div class="ui red cancel basic inverted button"> // addded "cancel"
   <i class="remove icon"></i>
      NE
</div>

您也可以<div class="ui green basic inverted button"> // without "ok" onApprove doesn't fires <i class="checkmark icon"></i> DA </div> <div class="ui red cancel basic inverted button"> // without "cancel" onDeny doesn't fire <i class="remove icon"></i> NE </div> 使用positive/approvenegative/deny ok/cancel作为semantic-ui example:

  

模态会自动将批准拒绝回调绑定到任何   肯定/批准,否定/拒绝或确定/取消按钮。

查看此工作 jsfiddle

希望这有帮助,