Skip to content

Commit 381d6c3

Browse files
Merge pull request #123 from mesqueeb/patch-4
fix(docs): improve dynamic modal docs
2 parents 2cc9b75 + d5afddd commit 381d6c3

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

docs/content/en/dynamic-modal.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,17 @@ badge: v2.0.0+
77
version: 3
88
---
99

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:
1111

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
1319

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:
1521

1622
```html[App.vue]
1723
<div>
@@ -20,9 +26,11 @@ All dynamic modals will be displayed in `ModalsContainer`. You can get all dynam
2026
</div>
2127
```
2228

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+
2331
## API
2432

25-
### `show(dynamicModalOptions, params)`
33+
### `$vfm.show(dynamicModalOptions, params)`
2634

2735
- Type: `Function`,
2836
- Arguments:
@@ -48,9 +56,9 @@ All dynamic modals will be displayed in `ModalsContainer`. You can get all dynam
4856
4957
To show dynamic modal you can use the API `$vfm.show` function.
5058
51-
### `dynamicModals`
59+
### `$vfm.dynamicModals`
5260
53-
- Return:
61+
- Type:
5462
- `Array`: returns dynamic modal instances.
5563
- Examples:
5664
- get the first created dynamic modal instance
@@ -364,4 +372,4 @@ export default {
364372
</script>
365373
```
366374

367-
</sfc-view>
375+
</sfc-view>

0 commit comments

Comments
 (0)