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: README.md
+62-7Lines changed: 62 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -200,11 +200,29 @@ You can use:
200
200
201
201
All modal instances include show and hide.
202
202
203
-
### `$vfm.show(name)`
203
+
### `$vfm.show(name, params)`
204
204
205
205
- Type: `Function`
206
206
- Arguments:
207
207
- name: `String` - Name of the modal
208
+
- params: `?: object` - Any data that you would want to pass into the modal (@before-open event handler will contain `params` in the event). You can also using scoped-slot to get `params` in template:
209
+
210
+
```html
211
+
<templatev-slot="{ params }">
212
+
<!-- modal content -->
213
+
</template>
214
+
```
215
+
216
+
Or get `params` on `@beforeOpen` event:
217
+
218
+
```html
219
+
<vue-final-modal@beforeOpen="e => e.ref.params">
220
+
<!-- modal content -->
221
+
</vue-final-modal>
222
+
```
223
+
224
+
> `parmas` will be reset to `{}` automatically after `closed` event. You can avoid the modal to reset the `params` to empty object by calling `event.stop()`.
225
+
208
226
- Example:
209
227
210
228
```html
@@ -254,12 +272,29 @@ export default {
254
272
255
273
hide all modals.
256
274
257
-
### `$vfm.toggle(name, show)`
275
+
### `$vfm.toggle(name, show, params)`
258
276
259
277
- Type: `Function`
260
278
- Arguments:
261
279
- name: `String` - Name of the modal
262
-
- show: `Boolean` - Show modal or not
280
+
- show: `?: Boolean` - Show modal or not
281
+
- params: `?: object` - Any data that you would want to pass into the modal (@before-open event handler will contain params in the event). You can also using scoped-slot to get `params` in template:
282
+
283
+
```html
284
+
<templatev-slot="{ params }">
285
+
<!-- modal content -->
286
+
</template>
287
+
```
288
+
289
+
Or get `params` on `@beforeOpen` event:
290
+
291
+
```html
292
+
<vue-final-modal@beforeOpen="e => e.ref.params">
293
+
<!-- modal content -->
294
+
</vue-final-modal>
295
+
```
296
+
297
+
> `parmas` will be reset to `{}` automatically after `closed` event. You can avoid the modal to reset the `params` to empty object by calling `event.stop()`.
263
298
264
299
toggle modal by name.
265
300
@@ -300,21 +335,41 @@ toggle modal by name.
300
335
301
336
### `@before-open`
302
337
303
-
- Emits while modal is still invisible, but before transition starting. Further opening of the modal can be blocked from this event listener by calling `event.stop()`.
338
+
- Emits while modal is still invisible, but before transition starting. Further opening of the modal can be blocked from this event listener by calling `event.stop()`.
304
339
305
340
### `@opened`
306
341
307
342
- Emits after modal became visible and transition ended.
308
343
309
344
### `@before-close`
310
345
311
-
- Emits before modal is going to be closed. Further closing of the modal can be blocked from this event listener by calling `event.stop()`.
346
+
- Emits before modal is going to be closed. Further closing of the modal can be blocked from this event listener by calling `event.stop()`.
312
347
313
348
### `@closed`
314
349
315
-
- Emits right before modal is destroyed.
350
+
- Emits right before modal is destroyed. Further after the modal was closed, you can avoid the modal to reset the `params` to empty object by calling `event.stop()`.
351
+
352
+
## **Slots**
353
+
354
+
If you open a modal though API `show(name, params)`, You can using scoped-slot to get `params` in template:
355
+
356
+
```html
357
+
<templatev-slot="{ params }">
358
+
<!-- modal content -->
359
+
</template>
360
+
```
361
+
362
+
Or get `params` on `@beforeOpen` event:
363
+
364
+
```html
365
+
<vue-final-modal@beforeOpen="e => e.ref.params">
366
+
<!-- modal content -->
367
+
</vue-final-modal>
368
+
```
369
+
370
+
> `parmas` will be reset to `{}` automatically after `closed` event. You can avoid the modal to reset the `params` to empty object by calling `event.stop()`.
Copy file name to clipboardExpand all lines: docs/content/en/index.md
+63-22Lines changed: 63 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -168,8 +168,6 @@ this.$vfm.show('example')
168
168
169
169
## **Configuration**
170
170
171
-
<badge>v0.18+</badge>
172
-
173
171
Configuration options can be passed as a second argument to `Vue.use`.
174
172
175
173
```js
@@ -194,8 +192,6 @@ Changes API name from "$vfm" to any other string value. It is useful when you us
194
192
195
193
## **API**
196
194
197
-
<badge>v0.15+</badge>
198
-
199
195
Plugin API can be called within any component through `this.$vfm`.
200
196
201
197
### `$vfm.openedModals`
@@ -214,11 +210,29 @@ You can use:
214
210
215
211
All modal instances include show and hide.
216
212
217
-
### `$vfm.show(name)`
213
+
### `$vfm.show(name, params)`
218
214
219
215
- Type: `Function`
220
216
- Arguments:
221
217
- name: `String` - Name of the modal
218
+
- params: `?: object` - Any data that you would want to pass into the modal (@before-open event handler will contain `params` in the event). You can also using scoped-slot to get params in template:
219
+
220
+
```html
221
+
<templatev-slot="{ params }">
222
+
<!-- modal content -->
223
+
</template>
224
+
```
225
+
226
+
Or get `params` on `@beforeOpen` event:
227
+
228
+
```html
229
+
<vue-final-modal@beforeOpen="e => e.ref.params">
230
+
<!-- modal content -->
231
+
</vue-final-modal>
232
+
```
233
+
234
+
> `parmas` will be reset to `{}` automatically after `closed` event. You can avoid the modal to reset the `params` to empty object by calling `event.stop()`.
235
+
222
236
- Example:
223
237
224
238
```html
@@ -268,12 +282,29 @@ export default {
268
282
269
283
hide all modals.
270
284
271
-
### `$vfm.toggle(name, show)`
285
+
### `$vfm.toggle(name, show, params)`
272
286
273
287
- Type: `Function`
274
288
- Arguments:
275
289
- name: `String` - Name of the modal
276
-
- show: `Boolean` - Show modal or not
290
+
- show: `?: Boolean` - Show modal or not
291
+
- params: `?: object` - Any data that you would want to pass into the modal (@before-open event handler will contain params in the event). You can also using scoped-slot to get params in template:
292
+
293
+
```html
294
+
<templatev-slot="{ params }">
295
+
<!-- modal content -->
296
+
</template>
297
+
```
298
+
299
+
Or get `params` on `@beforeOpen` event:
300
+
301
+
```html
302
+
<vue-final-modal@beforeOpen="e => e.ref.params">
303
+
<!-- modal content -->
304
+
</vue-final-modal>
305
+
```
306
+
307
+
> `parmas` will be reset to `{}` automatically after `closed` event. You can avoid the modal to reset the `params` to empty object by calling `event.stop()`.
277
308
278
309
toggle modal by name.
279
310
@@ -308,23 +339,20 @@ Custom class names for the modal content element.
308
339
Custom class names for the modal overlay element.
309
340
310
341
### `styles`
311
-
<badge>v0.17+</badge><badge>v1.4+</badge>
312
342
313
343
- Type: `[String, Object, Array]`
314
344
- Default: `''`
315
345
316
346
Style that will be applied to the modal container element.
317
347
318
348
### `contentStyle`
319
-
<badge>v0.17+</badge><badge>v1.4+</badge>
320
349
321
350
- Type: `[String, Object, Array]`
322
351
- Default: `''`
323
352
324
353
Style that will be applied to the modal content element.
325
354
326
355
### `overlayStyle`
327
-
<badge>v0.17+</badge><badge>v1.4+</badge>
328
356
329
357
- Type: `[String, Object, Array]`
330
358
- Default: `''`
@@ -394,8 +422,6 @@ Clicking overlay of modal to close the modal.
394
422
395
423
### `escToClose`
396
424
397
-
<badge>v0.19+</badge>
398
-
399
425
- Type: `Boolean`
400
426
- Default: `false`
401
427
@@ -436,8 +462,6 @@ Set specific `z-index` to root of the modal element. If zIndex is set, `zIndexBa
436
462
437
463
### `focusRemain`
438
464
439
-
<badge>v0.19+</badge>
440
-
441
465
- Type: `Boolean`
442
466
- Default: `true`
443
467
@@ -477,8 +501,6 @@ Enables focus trap meaning that only inputs/buttons that are withing the modal w
477
501
478
502
### `@click-outside`
479
503
480
-
<badge>v0.14+</badge>
481
-
482
504
- Emits while modal container on click.
483
505
484
506
<alert>
@@ -489,23 +511,42 @@ If prop `clickToClose` is `false`, the event will still be emitted.
489
511
490
512
### `@before-open`
491
513
492
-
- Emits while modal is still invisible, but before transition starting. Further opening of the modal can be blocked from this event listener by calling `event.stop()`.
514
+
- Emits while modal is still invisible, but before transition starting. Further opening of the modal can be blocked from this event listener by calling `event.stop()`.
493
515
494
516
### `@opened`
495
517
496
518
- Emits after modal became visible and transition ended.
497
519
498
520
### `@before-close`
499
521
500
-
- Emits before modal is going to be closed. Further closing of the modal can be blocked from this event listener by calling `event.stop()` .
501
-
502
-
#
522
+
- Emits before modal is going to be closed. Further closing of the modal can be blocked from this event listener by calling `event.stop()`.
503
523
504
524
### `@closed`
505
525
506
-
- Emits right before modal is destroyed.
526
+
- Emits right before modal is destroyed. Further after the modal was closed, you can avoid the modal to reset the `params` to empty object by calling `event.stop()`.
527
+
528
+
## **Slots**
529
+
530
+
If you open a modal though API `$vfm.show(name, params)`, You can using scoped-slot to get `params` in template:
531
+
532
+
```html
533
+
<templatev-slot="{ params }">
534
+
<!-- modal content -->
535
+
</template>
536
+
```
537
+
538
+
Or get `params` on `@beforeOpen` event:
539
+
540
+
```html
541
+
<vue-final-modal@beforeOpen="e => e.ref.params">
542
+
<!-- modal content -->
543
+
</vue-final-modal>
544
+
```
545
+
546
+
> `parmas` will be reset to `{}` automatically after `closed` event. You can avoid the modal to reset the `params` to empty object by calling `event.stop()`.
0 commit comments