一,官方推荐的样码。
<button type="button" class="uk-button" onclick="UIkit.modal.prompt('Name:', '', function(val){ UIkit.modal.alert('Hello '+(val || 'Mr noname')+'!'); });">Prompt</button> <pre><code>UIkit.modal.prompt("Name:", value, function(newvalue){ // 点击OK提交后执行 });</code></pre>
二,我实现的样码
var statu = UIkit.modal.confirm("将发布单" + deploy_version + "从" + org_type + "部署到" + env_type + "环境。是否确认?" ,function() { promiseJenkins = $.ajax({ url:'/valid/env_valid/', type: 'post', data:{ deploy_version: deploy_version, env_type: env_type, org_type: org_type, }, dataType: 'json', beforeSend: function(){ $(_self).attr('disabled',"true"); $(_self).append(" <i class='uk-icon-cog uk-icon-spin'></i>"); }, error: function(){ alert('500 Error.'); }, success: function(json){ $(_self).children('i').remove(); $(_self).append(" <i class='uk-icon-check'></i>") window.location.reload(); console.log(json); UIkit.notify(json.return, {timeout: 0}); } }); });
三,LOOK: