fix: modal update config not work

pull/2682/head
tangjinzhou 2020-08-01 16:06:13 +08:00
parent 515d90513c
commit 1eb76e2300
5 changed files with 16 additions and 11 deletions

@ -1 +1 @@
Subproject commit 7edb9609894a10324fc71095b197f64bddb98795 Subproject commit 4b4c51535a790c0b06818d5d17f973148d8e65db

View File

@ -12,14 +12,20 @@ export default function confirm(config) {
let confirmDialogInstance = null; let confirmDialogInstance = null;
let confirmDialogProps = {}; let confirmDialogProps = {};
function close(...args) { function close(...args) {
destroy(...args); currentConfig = {
...currentConfig,
visible: false,
afterClose: destroy.bind(this, ...args),
};
update(currentConfig);
} }
function update(newConfig) { function update(newConfig) {
currentConfig = { currentConfig = {
...currentConfig, ...currentConfig,
...newConfig, ...newConfig,
}; };
Object.assign(confirmDialogInstance, currentConfig); confirmDialogInstance &&
Object.assign(confirmDialogInstance, { confirmDialogProps: currentConfig });
} }
function destroy(...args) { function destroy(...args) {
if (confirmDialogInstance && div.parentNode) { if (confirmDialogInstance && div.parentNode) {

View File

@ -51,6 +51,7 @@ let cacheOverflow = {};
export default { export default {
name: 'VcDialog', name: 'VcDialog',
mixins: [BaseMixin], mixins: [BaseMixin],
inheritAttrs: false,
props: initDefaultProps(IDialogPropTypes, { props: initDefaultProps(IDialogPropTypes, {
mask: true, mask: true,
visible: false, visible: false,
@ -261,12 +262,10 @@ export default {
</button> </button>
); );
} }
const { style: stl, class: className } = this.$attrs;
const style = dest; const style = { ...stl, ...dest };
const sentinelStyle = { width: 0, height: 0, overflow: 'hidden' }; const sentinelStyle = { width: 0, height: 0, overflow: 'hidden' };
const cls = { const cls = [prefixCls, className, dialogClass];
[prefixCls]: true,
};
const transitionName = this.getTransitionName(); const transitionName = this.getTransitionName();
const dialogElement = ( const dialogElement = (
<LazyRenderBox <LazyRenderBox
@ -275,7 +274,7 @@ export default {
role="document" role="document"
ref="dialog" ref="dialog"
style={style} style={style}
class={[cls, dialogClass]} class={cls}
forceRender={forceRender} forceRender={forceRender}
onMousedown={this.onDialogMouseDown} onMousedown={this.onDialogMouseDown}
> >

View File

@ -4,7 +4,7 @@
</div> </div>
</template> </template>
<script> <script>
import demo from '../antdv-demo/docs/list/demo/index'; import demo from '../antdv-demo/docs/modal/demo/index';
export default { export default {
components: { components: {

View File

@ -176,7 +176,7 @@
}, },
"dependencies": { "dependencies": {
"@ant-design-vue/babel-helper-vue-compatible-props": "^1.0.0", "@ant-design-vue/babel-helper-vue-compatible-props": "^1.0.0",
"@ant-design/icons-vue": "^5.0.0-beta.0", "@ant-design/icons-vue": "^5.0.0",
"@babel/runtime": "^7.10.5", "@babel/runtime": "^7.10.5",
"@simonwep/pickr": "~1.7.0", "@simonwep/pickr": "~1.7.0",
"add-dom-event-listener": "^1.0.2", "add-dom-event-listener": "^1.0.2",