From 1eb76e23002e5cff84afa7d238dd26fd04c46855 Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Sat, 1 Aug 2020 16:06:13 +0800 Subject: [PATCH] fix: modal update config not work --- antdv-demo | 2 +- components/modal/confirm.js | 10 ++++++++-- components/vc-dialog/Dialog.jsx | 11 +++++------ examples/App.vue | 2 +- package.json | 2 +- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/antdv-demo b/antdv-demo index 7edb96098..4b4c51535 160000 --- a/antdv-demo +++ b/antdv-demo @@ -1 +1 @@ -Subproject commit 7edb9609894a10324fc71095b197f64bddb98795 +Subproject commit 4b4c51535a790c0b06818d5d17f973148d8e65db diff --git a/components/modal/confirm.js b/components/modal/confirm.js index 1afd8ab13..1d191be49 100644 --- a/components/modal/confirm.js +++ b/components/modal/confirm.js @@ -12,14 +12,20 @@ export default function confirm(config) { let confirmDialogInstance = null; let confirmDialogProps = {}; function close(...args) { - destroy(...args); + currentConfig = { + ...currentConfig, + visible: false, + afterClose: destroy.bind(this, ...args), + }; + update(currentConfig); } function update(newConfig) { currentConfig = { ...currentConfig, ...newConfig, }; - Object.assign(confirmDialogInstance, currentConfig); + confirmDialogInstance && + Object.assign(confirmDialogInstance, { confirmDialogProps: currentConfig }); } function destroy(...args) { if (confirmDialogInstance && div.parentNode) { diff --git a/components/vc-dialog/Dialog.jsx b/components/vc-dialog/Dialog.jsx index f953c1a3a..13273931b 100644 --- a/components/vc-dialog/Dialog.jsx +++ b/components/vc-dialog/Dialog.jsx @@ -51,6 +51,7 @@ let cacheOverflow = {}; export default { name: 'VcDialog', mixins: [BaseMixin], + inheritAttrs: false, props: initDefaultProps(IDialogPropTypes, { mask: true, visible: false, @@ -261,12 +262,10 @@ export default { ); } - - const style = dest; + const { style: stl, class: className } = this.$attrs; + const style = { ...stl, ...dest }; const sentinelStyle = { width: 0, height: 0, overflow: 'hidden' }; - const cls = { - [prefixCls]: true, - }; + const cls = [prefixCls, className, dialogClass]; const transitionName = this.getTransitionName(); const dialogElement = ( diff --git a/examples/App.vue b/examples/App.vue index 3d5016ff7..92af9b1ea 100644 --- a/examples/App.vue +++ b/examples/App.vue @@ -4,7 +4,7 @@