diff --git a/src/dialog-config.js b/src/dialog-config.js index 0ef6cc7..efb62de 100644 --- a/src/dialog-config.js +++ b/src/dialog-config.js @@ -63,6 +63,9 @@ define({ // 注意:css 只允许加载一个 cssUri: '../css/ui-dialog.css', + // 是否在tirgger一些未定义的事件的时候,自动在close之后remove掉弹窗 + isAutoRemove: true, + // 模板(使用 table 解决 IE7 宽度自适应的 BUG) // js 使用 i="***" 属性识别结构,其余的均可自定义 innerHTML: @@ -90,4 +93,4 @@ define({ + '' +'' -}); \ No newline at end of file +}); diff --git a/src/dialog.js b/src/dialog.js index 1a7488c..a4feb3e 100644 --- a/src/dialog.js +++ b/src/dialog.js @@ -71,7 +71,6 @@ var artDialog = function (options, ok, cancel) { // 快捷关闭支持:点击对话框外快速关闭对话框 if (options.quickClose) { options.modal = true; - options.backdropOpacity = 0; } @@ -454,8 +453,19 @@ $.extend(prototype, { _trigger: function (id) { var fn = this.callbacks[id]; - return typeof fn !== 'function' || fn.call(this) !== false ? - this.close().remove() : this; + if (typeof fn !== 'function' || fn.call(this) !== false) { + + // 根据是否isAutoRemove来判断是否需要执行remove() + if (this.isAutoRemove) { + res = this.close().remove(); + } else { + res = this.close(); + } + } else { + res = this; + } + + return res; } }); diff --git a/test/isAutoRemove.html b/test/isAutoRemove.html new file mode 100644 index 0000000..6093178 --- /dev/null +++ b/test/isAutoRemove.html @@ -0,0 +1,41 @@ + + + + + test + + + + + + + + +