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); + } } } });