Skip to content

Commit

Permalink
格式化失误
Browse files Browse the repository at this point in the history
  • Loading branch information
zyb-boye committed Sep 25, 2017
1 parent a77d367 commit 823b906
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/ui/Dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Dialog.prototype = {
* @param {Object} options 参数
* @private
*/
init: function (options) {
init: function(options) {
// 在 body 下创建对话框和遮罩层
this.$container = $('<div style="display:none;"></div>');
this.$mask = $('<div class="biz-mask" style="display:none;"></div>');
Expand All @@ -64,7 +64,7 @@ Dialog.prototype = {
'<div class="biz-dialog-content"></div>',
'<div class="biz-dialog-bottom"></div>'
].join(''))
.on('click.bizDialog', '.biz-dialog-close', function () {
.on('click.bizDialog', '.biz-dialog-close', function() {
self.close();
});
this.$container.find('.biz-dialog-content').append(this.$main.show()); // 把目标元素移至 $container 中
Expand Down Expand Up @@ -113,7 +113,7 @@ Dialog.prototype = {
/**
* 打开对话框
*/
open: function () {
open: function() {
var index = this.options.zIndex || ++currentIndex;

this.$mask.css({
Expand All @@ -134,7 +134,7 @@ Dialog.prototype = {
/**
* 关闭对话框
*/
close: function () {
close: function() {
var result = true;
if (typeof this.options.onBeforeClose == 'function') {
result = this.options.onBeforeClose();
Expand All @@ -158,15 +158,15 @@ Dialog.prototype = {
* 更新按钮
* @param {Array} buttonOption 底部按钮的 option 数组
*/
updateButtons: function (buttonOption) {
updateButtons: function(buttonOption) {
buttonOption = buttonOption || [];
var bottom = this.$container.find('.biz-dialog-bottom'),
self = this;
bottom.find('button').bizButton('destroy').off().remove();
$.each(buttonOption, function (index, buttonOption) {
$.each(buttonOption, function(index, buttonOption) {
var button = $('<button></button>').appendTo(bottom).bizButton(buttonOption);
if (buttonOption.onClick) {
button.click(function (e) {
button.click(function(e) {
buttonOption.onClick.call(self, e);
});
}
Expand All @@ -178,7 +178,7 @@ Dialog.prototype = {
* @param {String} [title] 标题
* @return {String}
*/
title: function (title) {
title: function(title) {
var titleElement = this.$container.find('.biz-panel-title-text');
if (undefined === title) {
return titleElement.html();
Expand All @@ -189,7 +189,7 @@ Dialog.prototype = {
/**
* 销毁
*/
destroy: function () {
destroy: function() {
if (this.options.draggable) {
this.draggable.destroy();
}
Expand All @@ -201,7 +201,7 @@ Dialog.prototype = {
}
};

var alert = function (options) {
var alert = function(options) {
if (!jQuery.isPlainObject(options)) {
options = {
content: options
Expand All @@ -222,15 +222,15 @@ var alert = function (options) {
buttons: [{
text: options.okText,
theme: options.theme,
onClick: function () {
onClick: function() {
this.close();
}
}]
});
alert.bizDialog('open');
};

var confirm = function (options) {
var confirm = function(options) {
var defaultOption = {
content: '',
okText: '确定',
Expand All @@ -246,7 +246,7 @@ var confirm = function (options) {
buttons: [{
text: options.okText,
theme: options.theme,
onClick: function () {
onClick: function() {
var result = true;
if (typeof options.onOK == 'function') {
result = options.onOK();
Expand All @@ -259,7 +259,7 @@ var confirm = function (options) {
}, {
text: options.cancelText,
theme: 'gray',
onClick: function () {
onClick: function() {
this.close();
}
}]
Expand All @@ -268,9 +268,9 @@ var confirm = function (options) {
};

$.extend($.fn, {
bizDialog: function (method) {
bizDialog: function(method) {
var internal_return, args = arguments;
this.each(function () {
this.each(function() {
var instance = $(this).data(dataKey);
if (instance) {
if (typeof method === 'string' && typeof instance[method] === 'function') {
Expand Down

0 comments on commit 823b906

Please sign in to comment.