Merge pull request #6977 from yanhao98/fix-DynamicDialog
fix(DynamicDialog): delay instance removal until after hide animationmaster
commit
7d5c03d904
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<template v-for="(instance, key) in instanceMap" :key="key">
|
<template v-for="(instance, key) in instanceMap" :key="key">
|
||||||
<DDialog v-model:visible="instance.visible" :_instance="instance" v-bind="instance.options.props" @hide="onDialogHide(instance)" @after-hide="onDialogAfterHide">
|
<DDialog v-model:visible="instance.visible" :_instance="instance" v-bind="instance.options.props" @hide="onDialogHide(instance)" @after-hide="onDialogAfterHide(instance)">
|
||||||
<template v-if="instance.options.templates && instance.options.templates.header" #header>
|
<template v-if="instance.options.templates && instance.options.templates.header" #header>
|
||||||
<component v-for="(header, index) in getTemplateItems(instance.options.templates.header)" :is="header" :key="index + '_header'" v-bind="instance.options.emits"></component>
|
<component v-for="(header, index) in getTemplateItems(instance.options.templates.header)" :is="header" :key="index + '_header'" v-bind="instance.options.emits"></component>
|
||||||
</template>
|
</template>
|
||||||
|
@ -61,11 +61,11 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
onDialogHide(instance) {
|
onDialogHide(instance) {
|
||||||
!this.currentInstance && instance.options.onClose && instance.options.onClose({ type: 'dialog-close' });
|
!this.currentInstance && instance.options.onClose && instance.options.onClose({ type: 'dialog-close' });
|
||||||
delete this.instanceMap[instance.key];
|
|
||||||
},
|
},
|
||||||
onDialogAfterHide() {
|
onDialogAfterHide(instance) {
|
||||||
this.currentInstance && delete this.currentInstance;
|
this.currentInstance && delete this.currentInstance;
|
||||||
this.currentInstance = null;
|
this.currentInstance = null;
|
||||||
|
delete this.instanceMap[instance.key];
|
||||||
},
|
},
|
||||||
getTemplateItems(template) {
|
getTemplateItems(template) {
|
||||||
return Array.isArray(template) ? template : [template];
|
return Array.isArray(template) ? template : [template];
|
||||||
|
|
Loading…
Reference in New Issue