Closed johnson0903 closed 1 year ago
@johnson0903 ,
Yeah, it might be hard to manage the state of a dynamic modal in vue-final-modal@3.x without reopen a new modal.
I recently released the vue-final-modal@4.x. VFM 4 provide a new way to manage dynamic modals and that is useModal()
composable. It allow you to use patchOptions()
to update the state of a dynamic modal that created by useModal()
.
For example:
const { open, close, patchOptions } = useModal({
component: VueFinalModal,
slots: {
component: YourFormComponent,
attrs: { ...SomePropsPassToYourFormComponent }
}
})
open() // open the dynamic modal
// You can use `patchOptions()` to update the specific state in a dynamic modal.
patchOptions({
slots: {
attrs: { ...ThePropsThatYouNeedToUpdate }
}
})
You can checkout the new documentation and see if you like the new way to manage dynamic modals in v4. If you decide to upgrade to v4, you can follow the migration guide.
Version
vue-final-modal: v3.4.11
In my use case, the content of dynamic modal is generated through AJAX. For example, a couple of form input.
I don't want to execute another AJAX call when I close it and then reopen it.
Currently I found that if I close the dynamic modal, I can't manipulate the closed modal through
$vfm.modals
or reopen it by calling$vfm.show(name, params)