diff --git a/src/stores/dialogStore.ts b/src/stores/dialogStore.ts index 333af1a0b7..b85a2ec6aa 100644 --- a/src/stores/dialogStore.ts +++ b/src/stores/dialogStore.ts @@ -215,12 +215,19 @@ export const useDialogStore = defineStore('dialog', () => { F extends Component = Component >(options: ShowDialogOptions) { const dialogKey = options.key || genDialogKey() - - let dialog = dialogStack.value.find((d) => d.key === dialogKey) - + const existingIndex = dialogStack.value.findIndex( + (d) => d.key === dialogKey + ) + let dialog = + existingIndex !== -1 ? dialogStack.value[existingIndex] : undefined if (dialog) { - dialog.visible = true - riseDialog(dialog) + if (!dialog.visible) { + dialogStack.value.splice(existingIndex, 1) + dialog = createDialog({ ...options, key: dialogKey }) + } else { + dialog.visible = true + riseDialog(dialog) + } } else { dialog = createDialog({ ...options, key: dialogKey }) }