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
@@ -167,30 +169,17 @@ import VueFinalModal from 'vue-final-modal'
167
169
Vue.use(VueFinalModal(), { ... })
168
170
```
169
171
170
-
### `componentName`
171
-
172
-
- Type: `String`
173
-
- default: `'VueFinalModal'`
174
-
175
-
Changes component name from "VueFinalModal" to any other string value. It is useful when there is already a global "modal" component.
176
-
177
-
### `key`
178
-
179
-
- Type: `String`
180
-
- default: `'$vfm'`
181
-
182
-
Changes API name from "$vfm" to any other string value. It is useful when you use `vue-final-modal` as spinner, toast, notify, etc.
183
-
172
+
-`componentName`
173
+
-`key`
174
+
-`dynamicContainerName`
184
175
185
176
## **API**
186
177
187
178
- In Options API:
188
179
189
180
Plugin API can be called within any component through `this.$vfm`.
190
181
191
-
- In Composition API (Only in Vue 3 version):
192
-
193
-
> Only support in Vue 3
182
+
- In Composition API (Vue 3 only):
194
183
195
184
```js
196
185
import { inject } from'vue'
@@ -202,184 +191,47 @@ export default {
202
191
}
203
192
```
204
193
205
-
### `$vfm.show(name, params)`
206
-
207
-
- Type: `Function`
208
-
- Arguments:
209
-
- name: `String` - Name of the modal
210
-
- 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:
211
-
212
-
```html
213
-
<templatev-slot="{ params }">
214
-
<!-- modal content -->
215
-
</template>
216
-
```
217
-
218
-
Or get `params` on `@beforeOpen` event:
219
-
220
-
```html
221
-
<vue-final-modal@beforeOpen="e => e.ref.params">
222
-
<!-- modal content -->
223
-
</vue-final-modal>
224
-
```
225
-
226
-
> `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()`.
> `v-model` is necessary when you open a modal with `$vfm.show(name)` API.
252
-
253
-
### `$vfm.hide(name)`
254
-
255
-
- Type: `Function`
256
-
- Arguments:
257
-
- name: `String` - Name of the modal
258
-
- Example:
259
-
260
-
```html
261
-
<template>
262
-
<vue-final-modalv-model="show"name="example">Vue Final Modal is awesome</vue-final-modal>
263
-
</template>
264
-
265
-
<script>
266
-
exportdefault {
267
-
data: () => ({
268
-
show:true
269
-
}),
270
-
mounted () {
271
-
this.$vfm.hide('example')
272
-
}
273
-
}
274
-
</script>
275
-
```
276
-
277
-
### `$vfm.hideAll()`
278
-
279
-
hide all modals.
280
-
281
-
### `$vfm.toggle(name, show, params)`
282
-
283
-
- Type: `Function`
284
-
- Arguments:
285
-
- name: `String` - Name of the modal
286
-
- show: `?: Boolean` - Show modal or not
287
-
- 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:
288
-
289
-
```html
290
-
<templatev-slot="{ params }">
291
-
<!-- modal content -->
292
-
</template>
293
-
```
294
-
295
-
Or get `params` on `@beforeOpen` event:
296
-
297
-
```html
298
-
<vue-final-modal@beforeOpen="e => e.ref.params">
299
-
<!-- modal content -->
300
-
</vue-final-modal>
301
-
```
302
-
303
-
> `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()`.
304
-
305
-
toggle modals by name.
306
-
307
-
### `$vfm.get(name)`
308
-
309
-
- Type: `Function`
310
-
- Arguments:
311
-
- name: `String` - Name of the modal
312
-
313
-
return the modal instances.
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.
> If prop `clickToClose` is `false`, the event will still be emitted.
367
-
368
-
### `@before-open`
369
-
370
-
- 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()`.
371
-
372
-
### `@opened`
373
-
374
-
- Emits after modal became visible and transition ended.
375
-
376
-
### `@before-close`
377
-
378
-
- Emits before modal is going to be closed. Further closing of the modal can be blocked from this event listener by calling `event.stop()`.
379
-
380
-
### `@closed`
381
-
382
-
- 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()`.
230
+
-`@click-outside`
231
+
-`@before-open`
232
+
-`@opened`
233
+
-`@before-close`
234
+
-`@closed`
383
235
384
236
## **Slots**
385
237
@@ -403,7 +255,7 @@ Or get `params` on `@beforeOpen` event:
403
255
404
256
## **Contribution**
405
257
406
-
👋 Hi I'm Hunter, the author of `vue-final-modal`.
258
+
👋 Hi I'm Hunter, the author of `vue-final-modal`.
407
259
408
260
To develop vue-final-modal, I learn a lot from these awesome libraries:
409
261
@@ -420,6 +272,6 @@ To develop vue-final-modal, I learn a lot from these awesome libraries:
420
272
-[Bootstrap Vue](https://bootstrap-vue.org/)
421
273
- lockScroll
422
274
423
-
> There is no perfect library even the `final` of vue modal.
275
+
> There is no perfect library even the `final` of vue modal.
424
276
425
277
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