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
Before reporting a bug, please make sure that you have read through our documentation and you think your problem is indeed an issue related to our module. -->
12
+
13
+
### Version
14
+
15
+
vue-final-modal: <!-- ex: v0.19.0 -->
16
+
vue: <!-- ex: v2.6.12 -->
17
+
nuxt: <!-- ex: v2.12.0 -->
18
+
19
+
### OS
20
+
21
+
Mac or Windows
22
+
23
+
### Reproduction Link
24
+
<!--
25
+
A minimal test case based on one of:
26
+
- a fork of https://codesandbox.io/s/nuxtcontent-demo-l164h
about: Tell us how you use vue-final-modal & support our efforts in maintaining vue-final-modal
4
+
title: ''
5
+
labels: ''
6
+
assignees: hunterliu1003
7
+
8
+
---
9
+
10
+
# ❤️ I'm using **`vue-final-modal`**
11
+
12
+
If you (or your company) are using **`vue-final-modal`** - please let us know. We'd love to hear from you!
13
+
14
+
**`vue-final-modal`** is a community driven project, which means it's not maintained by a company. If you would like to help `vue-final-modal` - any of the following is greatly appreciated.
Copy file name to clipboardExpand all lines: README.md
+85-8Lines changed: 85 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,8 @@ Looking for a Vue 3 version? [It's over here](https://github.com/hunterliu1003/v
30
30
31
31
## Introduction
32
32
33
-
`Vue Final Modal` is a renderless component<br />
33
+
### **Vue Final Modal** is a **renderless component**!
34
+
34
35
You can create a [higher-order component](https://vue-final-modal.org/examples/recommended-use) easily and can customize `template`, `script` and `style` based on your needs.
35
36
36
37
features:
@@ -199,11 +200,29 @@ You can use:
199
200
200
201
All modal instances include show and hide.
201
202
202
-
### `$vfm.show(name)`
203
+
### `$vfm.show(name, params)`
203
204
204
205
- Type: `Function`
205
206
- Arguments:
206
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
+
207
226
- Example:
208
227
209
228
```html
@@ -253,12 +272,29 @@ export default {
253
272
254
273
hide all modals.
255
274
256
-
### `$vfm.toggle(name, show)`
275
+
### `$vfm.toggle(name, show, params)`
257
276
258
277
- Type: `Function`
259
278
- Arguments:
260
279
- name: `String` - Name of the modal
261
-
- 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()`.
- Emits while modal is still invisible, but before transition starting.
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()`.
301
339
302
340
### `@opened`
303
341
304
342
- Emits after modal became visible and transition ended.
305
343
306
344
### `@before-close`
307
345
308
-
- Emits before modal is going to be closed.
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()`.
309
347
310
348
### `@closed`
311
349
312
-
- 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()`.
371
+
372
+
## **Contribution**
373
+
374
+
👋 Hi I'm Hunter, the author of `vue-final-modal`.
375
+
376
+
To develop vue-final-modal, I learn a lot from these awesome libraries:
> There is no perfect library even the `final` of vue modal.
315
392
316
393
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