|
1 | 1 | <script setup lang="ts"> |
2 | | -import { computed, getCurrentInstance, nextTick, onBeforeUnmount, onMounted, ref, useAttrs, watch } from 'vue' |
| 2 | +import { computed, getCurrentInstance, nextTick, onBeforeUnmount, onMounted, ref, toRef, useAttrs, watch } from 'vue' |
3 | 3 | import { vueFinalModalProps } from './VueFinalModalProps' |
4 | 4 | import { useTransition } from './useTransition' |
5 | 5 | import { useToClose } from './useToClose' |
@@ -148,22 +148,25 @@ async function openLastOverlay() { |
148 | 148 | // Found the modals which has overlay and has `auto` overlayBehavior |
149 | 149 | const openedModalsOverlaysAuto = openedModalOverlays.filter((modal) => { |
150 | 150 | const modalExposed = getModalExposed(modal) |
151 | | - return modalExposed?.value.overlayBehavior === 'auto' && !modalExposed?.value.hideOverlay |
| 151 | + return modalExposed?.value.overlayBehavior.value === 'auto' && !modalExposed?.value.hideOverlay?.value |
152 | 152 | }) |
153 | 153 | // Only keep the last overlay open |
154 | 154 | openedModalsOverlaysAuto.forEach((modal, index) => { |
155 | 155 | const modalExposed = getModalExposed(modal) |
156 | 156 | if (!modalExposed?.value) |
157 | 157 | return |
158 | | - modalExposed.value.overlayVisible = index === openedModalsOverlaysAuto.length - 1 |
| 158 | + modalExposed.value.overlayVisible.value = index === openedModalsOverlaysAuto.length - 1 |
159 | 159 | }) |
160 | 160 | } |
161 | 161 |
|
| 162 | +const modalId = toRef(props, 'modalId') |
| 163 | +const hideOverlay = toRef(props, 'hideOverlay') |
| 164 | +const overlayBehavior = toRef(props, 'overlayBehavior') |
162 | 165 | const modalExposed = computed<ModalExposed>(() => ({ |
163 | | - modalId: props.modalId, |
164 | | - hideOverlay: props.hideOverlay, |
165 | | - overlayBehavior: props.overlayBehavior, |
166 | | - overlayVisible: overlayVisible.value, |
| 166 | + modalId, |
| 167 | + hideOverlay, |
| 168 | + overlayBehavior, |
| 169 | + overlayVisible, |
167 | 170 | toggle(show?: boolean): Promise<string> { |
168 | 171 | return new Promise((resolve) => { |
169 | 172 | resolveToggle = once((res: string) => resolve(res)) |
|
0 commit comments