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
@@ -188,15 +187,15 @@ Changes component name from "VueFinalModal" to any other string value. It is use
188
187
- Type: `String`
189
188
- default: `'$vfm'`
190
189
191
-
Changes API name from "$vfm" to any other string value. It is useful when you use `vue-final-modal` as spinner, toast, notify, etc.
190
+
Changes API name from "\$vfm" to any other string value. It is useful when you use `vue-final-modal` as spinner, toast, notify, etc.
192
191
193
192
## **API**
194
193
195
-
-In Options API:
194
+
-**Options API**
196
195
197
196
Plugin API can be called within any component through `this.$vfm`.
198
197
199
-
-In Composition API:
198
+
-**Composition API** <badge>Only in Vue 3 version</badge>
200
199
201
200
```js
202
201
import { inject } from'vue'
@@ -229,28 +228,33 @@ Or get `params` on `@beforeOpen` event:
229
228
</vue-final-modal>
230
229
```
231
230
232
-
> `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()`.
231
+
<alert>`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()`.</alert>
233
232
234
233
- Example:
235
234
236
235
```html
237
236
<template>
238
-
<vue-final-modalv-model="show"name="example">Vue Final Modal is awesome</vue-final-modal>
<alert>`v-model` is necessary when you open a modal with `$vfm.show(name)` API.</alert>
257
+
254
258
### `$vfm.hide(name)`
255
259
256
260
- Type: `Function`
@@ -260,19 +264,18 @@ export default {
260
264
261
265
```html
262
266
<template>
263
-
<vue-final-modalv-model="show"name="example">Vue Final Modal is awesome</vue-final-modal>
267
+
<vue-final-modalv-model="show"name="example">Vue Final Modal is awesome</vue-final-modal>
264
268
</template>
265
269
266
270
<script>
267
-
exportdefault {
268
-
name:'MyComponent',
271
+
exportdefault {
269
272
data: () => ({
270
273
show:true
271
274
}),
272
-
mounted() {
273
-
this.$vfm.hide('example')
275
+
mounted() {
276
+
this.$vfm.hide('example')
274
277
}
275
-
}
278
+
}
276
279
</script>
277
280
```
278
281
@@ -302,7 +305,7 @@ Or get `params` on `@beforeOpen` event:
302
305
</vue-final-modal>
303
306
```
304
307
305
-
> `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()`.
308
+
<alert>`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()`.</alert>
306
309
307
310
toggle modal by name.
308
311
@@ -321,6 +324,7 @@ return the modal comopnent instance.
321
324
A stack array store the opened modal's vue component instance.
322
325
323
326
You can use:
327
+
324
328
1.`$vfm.openedModals[0]` to get the first opened modal instance.
325
329
2.`$vfm.openedModals.length` to get how many modals is opened.
326
330
@@ -332,6 +336,15 @@ All modal instances include show and hide.
332
336
333
337
## **Props**
334
338
339
+
### `name`
340
+
341
+
- Type: `String`
342
+
- Default: `null`
343
+
344
+
Modal name for global API `$vfm.show(name)`, `$vfm.hide(name)`, etc.
345
+
346
+
<alert>`v-model` is necessary when you open a modal with `$vfm.show(name)` API.</alert>
347
+
335
348
### `ssr`
336
349
337
350
- Type: `Boolean`
@@ -464,7 +477,7 @@ Set the root element of `vue-final-modal` style to `pointer-events: none;`.
464
477
465
478
Specifies which DOM element that this component should detach to.
466
479
467
-
1. Set `false` will disabled this feature.
480
+
1. Set `false` will disabled this feature.
468
481
2. String can be any valid `querySelector`, e.g. `'body'`, `'#app'`.
469
482
3. Object can be any valid `Node`, e.g. `this.$refs.container`.
470
483
@@ -513,21 +526,20 @@ Enables focus trap meaning that only inputs/buttons that are withing the modal w
513
526
514
527
```vue
515
528
<template>
516
-
<vue-final-modal
517
-
@click-outside="clickOutside"
518
-
@before-open="beforeOpen"
519
-
@opened="opened"
520
-
@before-close="beforeClose"
521
-
@closed="closed"
522
-
>
523
-
...modal content
524
-
</vue-final-modal>
529
+
<vue-final-modal
530
+
@click-outside="clickOutside"
531
+
@before-open="beforeOpen"
532
+
@opened="opened"
533
+
@before-close="beforeClose"
534
+
@closed="closed"
535
+
>
536
+
...modal content
537
+
</vue-final-modal>
525
538
</template>
526
539
```
527
540
528
541
</show-code>
529
542
530
-
531
543
### `@click-outside`
532
544
533
545
- Emits while modal container on click.
@@ -544,7 +556,7 @@ If prop `clickToClose` is `false`, the event will still be emitted.
544
556
545
557
### `@opened`
546
558
547
-
- Emits after modal became visible and transition ended.
559
+
- Emits after modal became visible and transition ended.
548
560
549
561
### `@before-close`
550
562
@@ -572,12 +584,11 @@ Or get `params` on `@beforeOpen` event:
572
584
</vue-final-modal>
573
585
```
574
586
575
-
> `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()`.
576
-
587
+
<alert>`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()`.</alert>
577
588
578
589
## **Contribution**
579
590
580
-
👋 Hi I'm Hunter, the author of `vue-final-modal`.
591
+
👋 Hi I'm Hunter, the author of `vue-final-modal`.
581
592
582
593
To develop vue-final-modal, I learn a lot from these awesome libraries:
583
594
@@ -594,6 +605,6 @@ To develop vue-final-modal, I learn a lot from these awesome libraries:
594
605
-[Bootstrap Vue](https://bootstrap-vue.org/)
595
606
- lockScroll
596
607
597
-
> There is no perfect library even the `final` of vue modal.
608
+
<alert>There is no perfect library even the `final` of vue modal.</alert>
598
609
599
-
If you have any ideas for optimization of `vue-final-modal`, feel free to open [issues](https://github.com/hunterliu1003/vue-final-modal/issues) or [pull requests](https://github.com/hunterliu1003/vue-final-modal/pulls).
610
+
🚀 If you have any ideas for optimization of `vue-final-modal`, feel free to open [issues](https://github.com/hunterliu1003/vue-final-modal/issues) or [pull requests](https://github.com/hunterliu1003/vue-final-modal/pulls).
0 commit comments