You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/en/dynamic-modal.md
+15-7Lines changed: 15 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -7,11 +7,17 @@ badge: v2.0.0+
7
7
version: 3
8
8
---
9
9
10
-
This feature let you create modal dynamically.
10
+
Vue Final Modal has a helper function to dynamically show a modal. This means that you don't have to add the modal to your Vue template and you don't have to use `v-model` to hide or show the modal. You can simply execute `$vfm.show` and pass a modal component as per the example below:
11
11
12
-
## Add `ModalsContainer`
12
+
```js
13
+
this.$vfm.show({ component:'MyDynamicModal' })
14
+
```
15
+
16
+
The component `MyDynamicModal` is hypothetical, check the [Examples](#examples) below for an accurate example.
17
+
18
+
## Prerequisite
13
19
14
-
All dynamic modals will be displayed in `ModalsContainer`. You can get all dynamic modal instances by [$vfm.dynamicModals](#dynamicmodals).
20
+
As a requirement to using Dynamic modals you must add `<ModalsContainer />` to your main `App.vue` file like so:
15
21
16
22
```html[App.vue]
17
23
<div>
@@ -20,9 +26,11 @@ All dynamic modals will be displayed in `ModalsContainer`. You can get all dynam
20
26
</div>
21
27
```
22
28
29
+
`ModalsContainer` is an invisible Vue component that is responsible for hosting the Vue instances of your dynamic modals. You don't need to do add anything else to the `ModalsContainer`, as long as you include it in your Vue tree, you can use Dynamic modals.
30
+
23
31
## API
24
32
25
-
### `show(dynamicModalOptions, params)`
33
+
### `$vfm.show(dynamicModalOptions, params)`
26
34
27
35
- Type: `Function`,
28
36
- Arguments:
@@ -48,9 +56,9 @@ All dynamic modals will be displayed in `ModalsContainer`. You can get all dynam
48
56
49
57
To show dynamic modal you can use the API `$vfm.show` function.
0 commit comments