feat(dialog): Optimize dialog closing logic (#97)
- Add optional parameters to the close function to support parameterless calling - When the dialog parameter is not provided, automatically close the dialog box on the top of the stack
This commit is contained in:
@@ -49,7 +49,12 @@ export const useDialog = defineStore('dialog', () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const close = (dialog: { key: string }) => {
|
const close = (dialog?: { key: string }) => {
|
||||||
|
if (!dialog) {
|
||||||
|
stack.value.pop()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const item = stack.value.find((item) => item.key === dialog.key)
|
const item = stack.value.find((item) => item.key === dialog.key)
|
||||||
if (item?.keepAlive) {
|
if (item?.keepAlive) {
|
||||||
item.visible = false
|
item.visible = false
|
||||||
|
|||||||
Reference in New Issue
Block a user