File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -205,12 +205,19 @@ export const useDialogStore = defineStore('dialog', () => {
205205
206206 function showDialog ( options : ShowDialogOptions ) {
207207 const dialogKey = options . key || genDialogKey ( )
208-
209- let dialog = dialogStack . value . find ( ( d ) => d . key === dialogKey )
210-
208+ const existingIndex = dialogStack . value . findIndex (
209+ ( d ) => d . key === dialogKey
210+ )
211+ let dialog =
212+ existingIndex !== - 1 ? dialogStack . value [ existingIndex ] : undefined
211213 if ( dialog ) {
212- dialog . visible = true
213- riseDialog ( dialog )
214+ if ( ! dialog . visible ) {
215+ dialogStack . value . splice ( existingIndex , 1 )
216+ dialog = createDialog ( { ...options , key : dialogKey } )
217+ } else {
218+ dialog . visible = true
219+ riseDialog ( dialog )
220+ }
214221 } else {
215222 dialog = createDialog ( { ...options , key : dialogKey } )
216223 }
You can’t perform that action at this time.
0 commit comments