@@ -143,6 +143,8 @@ export default {
143
143
144
144
### ** Open modal with API**
145
145
146
+ > ` v-model ` is necessary when you open a modal with ` $vfm.show(name) ` API.
147
+
146
148
``` html
147
149
<vue-final-modal v-model =" showModal" name =" example" >
148
150
Modal Content Here
@@ -182,23 +184,23 @@ Changes API name from "$vfm" to any other string value. It is useful when you us
182
184
183
185
## ** API**
184
186
185
- Plugin API can be called within any component through ` this.$vfm ` .
186
-
187
- ### ` $vfm.openedModals `
188
-
189
- - Type: ` Array `
187
+ - In Options API:
190
188
191
- A stack array store the opened modal's vue component instance .
189
+ Plugin API can be called within any component through ` this.$vfm ` .
192
190
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):
196
192
197
- ### ` $vfm.modals `
193
+ > Only support in Vue 3
198
194
199
- - Type: ` Array `
195
+ ``` js
196
+ import { inject } from ' vue'
200
197
201
- All modal instances include show and hide.
198
+ export default {
199
+ setup () {
200
+ const $vfm = inject (' $vfm' )
201
+ }
202
+ }
203
+ ```
202
204
203
205
### ` $vfm.show(name, params) `
204
206
@@ -227,22 +229,27 @@ Or get `params` on `@beforeOpen` event:
227
229
228
230
``` html
229
231
<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 >
231
237
</template >
232
238
233
239
<script >
234
- export default {
235
- name: ' MyComponent' ,
240
+ export default {
236
241
data : () => ({
237
242
show: false
238
243
}),
239
- mounted () {
240
- this .$vfm .show (' example' )
244
+ mounted () {
245
+ this .$vfm .show (' example' , { userName : ' vue-final-modal ' } )
241
246
}
242
- }
247
+ }
243
248
</script >
244
249
```
245
250
251
+ > ` v-model ` is necessary when you open a modal with ` $vfm.show(name) ` API.
252
+
246
253
### ` $vfm.hide(name) `
247
254
248
255
- Type: ` Function `
@@ -257,7 +264,6 @@ export default {
257
264
258
265
<script >
259
266
export default {
260
- name: ' MyComponent' ,
261
267
data : () => ({
262
268
show: true
263
269
}),
@@ -298,11 +304,36 @@ Or get `params` on `@beforeOpen` event:
298
304
299
305
toggle modal by name.
300
306
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
+
301
331
## ** Props**
302
332
303
333
``` js
304
334
{
305
335
value: { type: Boolean , default: false },
336
+ name: { type: String , default: null },
306
337
ssr: { type: Boolean , default: true },
307
338
classes: { type: [String , Object , Array ], default: ' ' },
308
339
overlayClass: { type: [String , Object , Array ], default: ' ' },
@@ -318,6 +349,7 @@ toggle modal by name.
318
349
attach: { type: null , default: false , validator: validateAttachTarget },
319
350
transition: { type: String , default: ' vfm' },
320
351
overlayTransition: { type: String , default: ' vfm' },
352
+ zIndexAuto: { type: Boolean , default: true },
321
353
zIndexBase: { type: [String , Number ], default: 1000 },
322
354
zIndex: { type: [Boolean , String , Number ], default: false },
323
355
focusRetain: { type: Boolean , default: true },
0 commit comments