@@ -143,6 +143,8 @@ export default {
143143
144144### ** Open modal with API**
145145
146+ > ` v-model ` is necessary when you open a modal with ` $vfm.show(name) ` API.
147+
146148``` html
147149<vue-final-modal v-model =" showModal" name =" example" >
148150 Modal Content Here
@@ -182,23 +184,23 @@ Changes API name from "$vfm" to any other string value. It is useful when you us
182184
183185## ** API**
184186
185- Plugin API can be called within any component through ` this.$vfm ` .
186-
187- ### ` $vfm.openedModals `
188-
189- - Type: ` Array `
187+ - In Options API:
190188
191- A stack array store the opened modal's vue component instance .
189+ Plugin API can be called within any component through ` this.$vfm ` .
192190
193- You can use:
194- 1 . ` $vfm.openedModals[0] ` to get the first opened modal instance.
195- 2 . ` $vfm.openedModals.length ` to get how many modals is opened.
191+ - In Composition API (Only in Vue 3 version):
196192
197- ### ` $vfm.modals `
193+ > Only support in Vue 3
198194
199- - Type: ` Array `
195+ ``` js
196+ import { inject } from ' vue'
200197
201- All modal instances include show and hide.
198+ export default {
199+ setup () {
200+ const $vfm = inject (' $vfm' )
201+ }
202+ }
203+ ```
202204
203205### ` $vfm.show(name, params) `
204206
@@ -227,22 +229,27 @@ Or get `params` on `@beforeOpen` event:
227229
228230``` html
229231<template >
230- <vue-final-modal v-model =" show" name =" example" >Vue Final Modal is awesome</vue-final-modal >
232+ <vue-final-modal v-model =" show" name =" example" >
233+ <template v-slot =" { params }" >
234+ Hi {{ params.userName }}
235+ </template >
236+ </vue-final-modal >
231237</template >
232238
233239<script >
234- export default {
235- name: ' MyComponent' ,
240+ export default {
236241 data : () => ({
237242 show: false
238243 }),
239- mounted () {
240- this .$vfm .show (' example' )
244+ mounted () {
245+ this .$vfm .show (' example' , { userName : ' vue-final-modal ' } )
241246 }
242- }
247+ }
243248 </script >
244249```
245250
251+ > ` v-model ` is necessary when you open a modal with ` $vfm.show(name) ` API.
252+
246253### ` $vfm.hide(name) `
247254
248255- Type: ` Function `
@@ -257,7 +264,6 @@ export default {
257264
258265<script >
259266export default {
260- name: ' MyComponent' ,
261267 data : () => ({
262268 show: true
263269 }),
@@ -298,11 +304,36 @@ Or get `params` on `@beforeOpen` event:
298304
299305toggle modal by name.
300306
307+ ### ` $vfm.get(name) `
308+
309+ - Type: ` Function `
310+ - Arguments:
311+ - name: ` String ` - Name of the modal
312+
313+ return the modal comopnent instance.
314+
315+ ### ` $vfm.openedModals `
316+
317+ - Type: ` Array `
318+
319+ A stack array store the opened modal's vue component instance.
320+
321+ You can use:
322+ 1 . ` $vfm.openedModals[0] ` to get the first opened modal instance.
323+ 2 . ` $vfm.openedModals.length ` to get how many modals is opened.
324+
325+ ### ` $vfm.modals `
326+
327+ - Type: ` Array `
328+
329+ All modal instances include show and hide.
330+
301331## ** Props**
302332
303333``` js
304334{
305335 value: { type: Boolean , default: false },
336+ name: { type: String , default: null },
306337 ssr: { type: Boolean , default: true },
307338 classes: { type: [String , Object , Array ], default: ' ' },
308339 overlayClass: { type: [String , Object , Array ], default: ' ' },
@@ -318,6 +349,7 @@ toggle modal by name.
318349 attach: { type: null , default: false , validator: validateAttachTarget },
319350 transition: { type: String , default: ' vfm' },
320351 overlayTransition: { type: String , default: ' vfm' },
352+ zIndexAuto: { type: Boolean , default: true },
321353 zIndexBase: { type: [String , Number ], default: 1000 },
322354 zIndex: { type: [Boolean , String , Number ], default: false },
323355 focusRetain: { type: Boolean , default: true },
0 commit comments