Skip to content

Commit 535704d

Browse files
committed
docs: update docs
1 parent 5a7170b commit 535704d

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

docs/content/3.api/2.composables/1.use-modal.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,17 @@ import { ModalsContainer } from 'vue-final-modal'
2828
```ts
2929
import { VueFinalModal, useModal } from 'vue-final-modal'
3030

31-
const { open, close, options, patchOptions } = useModal({
32-
// `component` is optional and the default value is `<VueFinalModal>`.
33-
component: VueFinalModal,
31+
const { open, close, destroy, options, patchOptions } = useModal({
3432
// Open the modal or not when the modal was created, the default value is `false`.
3533
defaultModelValue: false,
34+
/**
35+
* If set `keepAlive` to `true`:
36+
* 1. The `displayDirective` will be set to `show` by default.
37+
* 2. The modal component will not be removed after the modal closed until you manually execute `destroy()`.
38+
*/
39+
keepAlive: false,
40+
// `component` is optional and the default value is `<VueFinalModal>`.
41+
component: VueFinalModal,
3642
attrs: {
3743
// Bind props to the modal component (VueFinalModal in this case).
3844
clickToClose: true,
@@ -49,6 +55,8 @@ const { open, close, options, patchOptions } = useModal({
4955
open().then(() => { /* Do something after modal opened */ })
5056
// Close the modal
5157
close().then(() => { /* Do something after modal closed */ })
58+
// Destroy the modal manually, it only be needed when the `keepAlive` is set to `true`
59+
destroy()
5260
// Checkout the modal options
5361
options // the state of the dynamic modal
5462

0 commit comments

Comments
 (0)