Skip to content

Commit caf72ba

Browse files
committed
fix: rename keepModalInstance to keepAlive
1 parent 24da202 commit caf72ba

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

packages/vue-final-modal/src/Modal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export type ModalSlot = string | Component | ModalSlotOptions
2424

2525
export type UseModalOptions<P> = {
2626
defaultModelValue?: boolean
27-
keepModalInstance?: boolean
27+
keepAlive?: boolean
2828
context?: Vfm
2929
component?: Constructor<P>
3030
attrs?: (RawProps & P) | ({} extends P ? null : never)

packages/vue-final-modal/src/useApi.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,13 @@ export function useModal<P = InstanceType<typeof VueFinalModal>['$props']>(_opti
7070
}
7171

7272
tryOnUnmounted(() => {
73-
if (!options.keepModalInstance)
73+
if (!options.keepAlive)
7474
destroy()
7575
})
7676

77+
if (options.modelValue === true)
78+
options.context?.dynamicModals.push(options)
79+
7780
function open(): Promise<string> {
7881
if (options.modelValue)
7982
return Promise.resolve('[Vue Final Modal] modal is already opened')
@@ -92,8 +95,8 @@ export function useModal<P = InstanceType<typeof VueFinalModal>['$props']>(_opti
9295
options.modelValue = false
9396
return new Promise((resolve) => {
9497
options.resolveClosed = () => {
95-
console.log(`close options.keepModalInstance`, options.keepModalInstance)
96-
if (!options.keepModalInstance)
98+
// console.log('close options.keepAlive', options.keepAlive)
99+
if (!options.keepAlive)
97100
destroy()
98101
resolve('closed')
99102
}

0 commit comments

Comments
 (0)