From 78b0d78b44cfaaf0ccafb62df354b934d5fa712c Mon Sep 17 00:00:00 2001 From: neverland Date: Mon, 17 Sep 2018 19:43:56 +0800 Subject: [PATCH] [bugfix] Dialog: promise status not change (#585) --- dist/dialog/index.js | 11 ++++++++++- packages/dialog/index.js | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/dist/dialog/index.js b/dist/dialog/index.js index 863d3689..7739bccc 100644 --- a/dist/dialog/index.js +++ b/dist/dialog/index.js @@ -77,12 +77,21 @@ create({ this.onClose(action); }, + close() { + this.setData({ show: false }); + }, + onClose(action) { if (!this.data.asyncClose) { - this.setData({ show: false }); + this.close(); } this.$emit('close', action); this.$emit(action); + + const callback = this.data[action === 'confirm' ? 'onConfirm' : 'onCancel']; + if (callback) { + callback(this); + } } } }); diff --git a/packages/dialog/index.js b/packages/dialog/index.js index 863d3689..7739bccc 100644 --- a/packages/dialog/index.js +++ b/packages/dialog/index.js @@ -77,12 +77,21 @@ create({ this.onClose(action); }, + close() { + this.setData({ show: false }); + }, + onClose(action) { if (!this.data.asyncClose) { - this.setData({ show: false }); + this.close(); } this.$emit('close', action); this.$emit(action); + + const callback = this.data[action === 'confirm' ? 'onConfirm' : 'onCancel']; + if (callback) { + callback(this); + } } } });