|
9 | 9 | <a href="https://www.npmjs.com/package/vue-final-modal"><img src="https://img.shields.io/npm/l/vue-final-modal.svg?sanitize=true" alt="License"></a> |
10 | 10 | </p> |
11 | 11 |
|
12 | | -### [Documentation](https://hunterliu1003.github.io/vue-final-modal/) |
13 | | -### [Examples](https://hunterliu1003.github.io/vue-final-modal/examples) |
14 | | -### [CDN example](https://codepen.io/hunterliu1003/pen/PoZmbPm?editors=1010) |
| 12 | +<p align="right"> |
| 13 | + <a href="https://www.buymeacoffee.com/PL2qJIx" target="_blank"> |
| 14 | + <img src="https://cdn.buymeacoffee.com/buttons/v2/default-green.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" > |
| 15 | + </a> |
| 16 | +</p> |
| 17 | + |
| 18 | +### 🎉 [Documentation](https://hunterliu1003.github.io/vue-final-modal/) |
| 19 | + |
| 20 | +### 🙌 [Examples](https://hunterliu1003.github.io/vue-final-modal/examples) |
| 21 | + |
| 22 | +### 🌏 [CDN example](https://codepen.io/hunterliu1003/pen/PoZmbPm?editors=1010) |
15 | 23 |
|
16 | 24 | ## Introduction |
17 | 25 |
|
| 26 | +If you need a highly customizable modal component for Vue.js, `Vue Final Modal` would be a nice choice. |
| 27 | + |
18 | 28 | features: |
19 | | - - Tailwind CSS friendly |
20 | | - - Renderless component |
21 | | - - SSR support |
22 | | - - Stackable |
23 | | - - Detachable |
24 | | - - Scrollable |
25 | | - - Transition support |
26 | | - - Mobile friendly |
27 | | - - 3.2kb gzipped |
28 | 29 |
|
| 30 | +- Tailwind CSS friendly |
| 31 | +- Renderless component |
| 32 | +- SSR support |
| 33 | +- Stackable |
| 34 | +- Detachable |
| 35 | +- Scrollable |
| 36 | +- Transition support |
| 37 | +- Mobile friendly |
| 38 | +- Tiny bundle size |
29 | 39 |
|
30 | 40 | ## Install |
31 | 41 |
|
32 | 42 | NPM: |
| 43 | + |
33 | 44 | ```bash |
34 | 45 | npm install vue-final-modal --save |
35 | 46 | ``` |
36 | 47 |
|
37 | | -Yarn: |
| 48 | +Yarn: |
38 | 49 |
|
39 | 50 | ```bash |
40 | 51 | yarn add vue-final-modal |
41 | 52 | ``` |
42 | 53 |
|
43 | | -## How to use |
| 54 | +## Basic usage |
44 | 55 |
|
45 | | -```html |
46 | | -<button @click="showModal = true">Show modal</button> |
| 56 | +1. Import and register the modal component. |
| 57 | + |
| 58 | +```js |
| 59 | +import { VueFinalModal } from 'vue-final-modal/lib' |
| 60 | + |
| 61 | +export default { |
| 62 | + components: { |
| 63 | + VueFinalModal |
| 64 | + } |
| 65 | +} |
| 66 | +``` |
| 67 | + |
| 68 | +2. Add the modal component to the template. |
47 | 69 |
|
| 70 | +```html |
48 | 71 | <vue-final-modal v-model="showModal"> |
49 | | - <button @click="showModal = false">close modal</button> |
| 72 | + Modal Content Here |
50 | 73 | </vue-final-modal> |
51 | 74 | ``` |
52 | 75 |
|
53 | | -```js |
54 | | -import { VueFinalModal } from 'vue-final-modal' |
| 76 | +3. Create a button to toggle the modal. |
55 | 77 |
|
56 | | -export default { |
57 | | - components: { |
58 | | - VueFinalModal, |
59 | | - }, |
60 | | - data: () => ({ |
61 | | - showModal: false |
62 | | - }) |
| 78 | +```html |
| 79 | +<button @click="showModal = true">Launch</button> |
| 80 | +``` |
| 81 | + |
| 82 | +4. All default props |
| 83 | + |
| 84 | +```js |
| 85 | +const CLASS_TYPES = [String, Object, Array] |
| 86 | + |
| 87 | +{ |
| 88 | + value: { type: Boolean, default: false }, |
| 89 | + ssr: { type: Boolean, default: true }, |
| 90 | + classes: { type: CLASS_TYPES, default: '' }, |
| 91 | + overlayClass: { type: CLASS_TYPES, default: '' }, |
| 92 | + contentClass: { type: CLASS_TYPES, default: '' }, |
| 93 | + lockScroll: { type: Boolean, default: true }, |
| 94 | + hideOverlay: { type: Boolean, default: false }, |
| 95 | + clickToClose: { type: Boolean, default: true }, |
| 96 | + preventClick: { type: Boolean, default: false }, |
| 97 | + attach: { type: null, default: false, validator: validateAttachTarget }, |
| 98 | + transition: { type: String, default: 'vfm' }, |
| 99 | + overlayTransition: { type: String, default: 'vfm' }, |
| 100 | + zIndexBase: { type: [String, Number], default: 1000 }, |
| 101 | + zIndex: { type: [Boolean, String, Number], default: false } |
63 | 102 | } |
64 | 103 | ``` |
65 | 104 |
|
| 105 | +5. Events. |
| 106 | + |
| 107 | +- @before-open: Before open |
| 108 | +- @opened: When opened |
| 109 | +- @before-close: Before close |
| 110 | +- @closed: After closed |
| 111 | + |
66 | 112 | ## Roadmap |
67 | 113 |
|
68 | 114 | 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 request](https://github.com/hunterliu1003/vue-final-modal/pulls). |
69 | 115 |
|
70 | | -These are the features that will be added in the comming weeks: |
| 116 | +like: |
71 | 117 |
|
72 | | -- draggable modal |
73 | | -- resizable modal |
74 | | -- dynamic emit modal component with vue directive like: |
75 | | - - `this.$modal.show('hello-world')` |
76 | | - - `this.$modal.hide('hello-world')` |
77 | | -- support Vue 3.0 |
| 118 | +- support Vue 3.0 |
0 commit comments