Skip to content

Commit

Permalink
dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
bigxxs authored Aug 5, 2018
1 parent 87d2bb3 commit 82baa24
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions kmui.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,42 @@
__dialog,
__dialogTitle,
__dialogContent,
__dialogButtons,

kmui = {
showMask: function () {
if (!__mask) {
__mask = $("<div class='kmui-mask'></div>").appendTo(window.document.body);
}
console.log(__mask);
__mask.show();
},
hideMask: function () {
__mask.hide();
},
dialog: function (options) {
this.showMask();
kmui.showMask();
if (!__dialog) {
var html = "<div class='kmui-dialog'>";
html += "<div class='kmui-dialog-title'>标题</div>";
html += "<div class='kmui-dialog-content'>内容</div>";
html += "<div class='kmui-dialog-buttons'></div>";
html += "</div>";
__dialog = $(html).appendTo(window.document.body);
}
__dialog.find('.kmui-dialog-title').text(options.title);
__dialog.find('.kmui-dialog-content').text(options.content);
var buttons = __dialog.find('.kmui-dialog-buttons');
buttons.html('');
for (var i = 0; i < options.buttons.length; i++) {
var btnDefine = options.buttons[i]
var btn = $('<a href="javascript:void(0);"></a>').appendTo(buttons);
btn.text(btnDefine.text);
btn.click(function () {
btnDefine.click();
__dialog.hide();
kmui.hideMask();
});
}
__dialog.show();
}
};
Expand Down

0 comments on commit 82baa24

Please sign in to comment.