diff --git a/docs/examples/dialog.md b/docs/examples/dialog.md index 05fa69801..7863a1488 100644 --- a/docs/examples/dialog.md +++ b/docs/examples/dialog.md @@ -7,6 +7,8 @@ export default { Dialog.alert({ title: 'alert', message: 'alert message' + }).then((action) => { + console.log(action); }); }, @@ -14,6 +16,10 @@ export default { Dialog.confirm({ title: 'confirm', message: 'confirm message' + }).then((action) => { + console.log(action); + }, (error) => { + console.log(error); }); } } diff --git a/packages/dialog/src/dialog.js b/packages/dialog/src/dialog.js index bb08501b8..0a3ff9623 100644 --- a/packages/dialog/src/dialog.js +++ b/packages/dialog/src/dialog.js @@ -16,9 +16,9 @@ const defaultCallback = action => { callback(action); } - if (currentDialog.resolve && action !== 'cancel') { + if (currentDialog.resolve && action === 'confirm') { currentDialog.resolve(action); - } else { + } else if (currentDialog.reject && action === 'cancel') { currentDialog.reject(action); } } @@ -47,7 +47,6 @@ var showNextDialog = () => { instance[prop] = options[prop]; } } - console.log(instance) if (options.callback === undefined) { instance.callback = defaultCallback; @@ -62,7 +61,6 @@ var showNextDialog = () => { }; var DialogBox = options => { - console.log(options) return new Promise((resolve, reject) => { // eslint-disable-line dialogQueue.push({ options: merge({}, options), @@ -78,13 +76,15 @@ var DialogBox = options => { DialogBox.alert = function(options) { return DialogBox(merge({ type: 'alert', - closeOnClickOverlay: false + closeOnClickOverlay: false, + showCancelButton: false }, options)); }; DialogBox.confirm = function(options) { return DialogBox(merge({ type: 'confirm', + closeOnClickOverlay: true, showCancelButton: true }, options)); }; diff --git a/packages/dialog/src/dialog.vue b/packages/dialog/src/dialog.vue index 62a1124c4..f68e29ced 100644 --- a/packages/dialog/src/dialog.vue +++ b/packages/dialog/src/dialog.vue @@ -1,5 +1,5 @@