完善alert组件

This commit is contained in:
张磊 2015-08-13 11:41:40 +08:00
parent 408398e46b
commit 41b715c62b
1 changed files with 12 additions and 14 deletions

View File

@ -166,26 +166,24 @@
})
var Alert = $.create({
installed: function () {
$(this.ok).on("click", function (evt) {
this.option.display = false;
evt.stopPropagation();
}.bind(this));
hide: function (evt) {
this.option.display = false;
evt.stopPropagation();
},
render: function () {
if (!this.option.display) return;
return '<div>\
<div class="ui-mask" style="height:' + (Math.max(document.body.scrollHeight, document.body.clientHeight) - 1) + 'px;"></div>\
<div class="ui-dialog">\
<div class="ui-dialog-title">\
<h3>{{title}}</h3>\
</div>\
<div class="ui-dialog-content">\
<div title="{{msg}}">\
<p>{{msg}}</p></div>\
<div class="ui-dialog" style="top:' + ((document.body.scrollTop || document.documentElement.scrollTop) + window.innerHeight / 2) + 'px">\
<div class="ui-dialog-title">\
<h3>{{title}}</h3>\
</div>\
<div class="ui-dialog-content">\
<div title="{{msg}}">\
<p>{{msg}}</p></div>\
</div>\
<div onclick="hide(event)" class="ui-dialog-btns"><a class="ui-btn ui-btn-1"></a>\
</div>\
<div nc-id="ok" class="ui-dialog-btns"><a class="ui-btn ui-btn-1"></a>\
</div>\
</div>\
</div>';
}