Skip to content

Commit f285e33

Browse files
committed
fix: not use destructure syntax
1 parent ddd1b55 commit f285e33

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

packages/vue-final-modal/src/components/ModalsContainer.vue

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,24 @@ import type { Ref } from 'vue'
55
import type { UseModalOptionsPrivate } from '../Modal'
66
import { useInternalVfm, useVfm } from '~/useApi'
77
8-
const { modalsContainers, dynamicModals } = useVfm()
9-
const { resolvedClosed, resolvedOpened } = useInternalVfm()
8+
const vfm = useVfm()
9+
const _vfm = useInternalVfm()
1010
1111
const uid = Symbol('ModalsContainer')
12-
const shouldMount = computed(() => uid === modalsContainers.value[0])
12+
const shouldMount = computed(() => uid === vfm.modalsContainers.value?.[0])
1313
1414
const openedDynamicModals: Ref<UseModalOptionsPrivate[]> = shallowRef([])
1515
1616
function syncOpenDynamicModals() {
17-
openedDynamicModals.value = dynamicModals.filter(modal => modal.modelValue)
17+
openedDynamicModals.value = vfm.dynamicModals.filter(modal => modal.modelValue)
1818
}
1919
2020
function withSyncOpenDynamicModals(callbackFn?: () => void) {
2121
callbackFn?.()
2222
syncOpenDynamicModals()
2323
}
2424
25-
watch(() => dynamicModals.map(modal => modal.modelValue), (value, oldValue) => {
25+
watch(() => vfm.dynamicModals?.map(modal => modal.modelValue), (value, oldValue) => {
2626
if (!oldValue || value.length !== oldValue.length) {
2727
syncOpenDynamicModals()
2828
return
@@ -44,9 +44,9 @@ watch(() => dynamicModals.map(modal => modal.modelValue), (value, oldValue) => {
4444
immediate: true,
4545
})
4646
47-
modalsContainers.value.push(uid)
47+
vfm.modalsContainers.value.push(uid)
4848
onBeforeUnmount(() => {
49-
modalsContainers.value = modalsContainers.value.filter(i => i !== uid)
49+
vfm.modalsContainers.value = vfm.modalsContainers.value.filter(i => i !== uid)
5050
})
5151
</script>
5252

@@ -58,8 +58,8 @@ onBeforeUnmount(() => {
5858
:key="modal.id"
5959
v-bind="modal.attrs"
6060
v-model="modal.modelValue"
61-
@closed="withSyncOpenDynamicModals(() => resolvedClosed(index))"
62-
@opened="() => resolvedOpened(index)"
61+
@closed="withSyncOpenDynamicModals(() => _vfm.resolvedClosed?.(index))"
62+
@opened="() => _vfm.resolvedOpened?.(index)"
6363
>
6464
<template v-for="(slot, key) in modal.slots" #[key] :key="key">
6565
<div v-if="isString(slot)" v-html="slot" />

0 commit comments

Comments
 (0)