Skip to content

Commit 70a8fae

Browse files
committed
Merge branch 'master' into next
2 parents 10d4670 + f823b7b commit 70a8fae

40 files changed

+1260
-1327
lines changed

README.md

Lines changed: 83 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@
1616
</a>
1717
</p>
1818

19-
### 🎉 [Documentation](https://vue-final-modal.org)
19+
Looking for a Vue 3 version? [It's over here](https://github.com/hunterliu1003/vue-final-modal/tree/next)
2020

21-
### 🙌 [Examples](https://vue-final-modal.org/examples)
21+
## 🎉 [Documentation](https://vue-final-modal.org)
22+
23+
## 🙌 [Examples](https://vue-final-modal.org/examples)
2224

2325
## Introduction
2426

25-
If you need a highly customizable modal component for Vue.js, `Vue Final Modal` would be a nice choice.
27+
`Vue Final Modal` is a renderless component<br />
28+
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.
2629

2730
features:
2831

@@ -36,8 +39,9 @@ features:
3639
- Transition support
3740
- Mobile friendly
3841
- Tiny bundle size
42+
- Accessibility support
3943

40-
## Install
44+
## Installation
4145

4246
**Vue 3.0**
4347

@@ -53,7 +57,7 @@ Yarn:
5357
yarn add vue-final-modal@next
5458
```
5559

56-
**Vue 2.x**
60+
**Vue 2.0**
5761

5862
NPM:
5963

@@ -69,7 +73,11 @@ yarn add vue-final-modal
6973

7074
## Basic usage
7175

72-
**1. Import and register the modal component.**
76+
### Register
77+
78+
#### Vue
79+
80+
- **Register in SFC**
7381

7482
```js
7583
import { VueFinalModal } from 'vue-final-modal'
@@ -81,21 +89,65 @@ export default {
8189
}
8290
```
8391

84-
**2. Add the modal component to the template.**
92+
- **Install globally**
93+
94+
```js
95+
import { VueFinalModal } from 'vue-final-modal'
96+
97+
Vue.component('VueFinalModal', VueFinalModal)
98+
```
99+
100+
#### Nuxt
101+
102+
- **Write a plugin `vue-final-modal.js`**
103+
104+
```js
105+
// plugins/vue-final-modal.js
106+
import VueFinalModal from 'vue-final-modal/lib/VueFinalModal.vue'
107+
108+
Vue.component('VueFinalModal', VueFinalModal)
109+
```
110+
111+
- **Add plugin into `nuxt.config.js`**
112+
113+
```js
114+
// nuxt.config.js
115+
export default {
116+
plugins: [
117+
'~plugins/vue-final-modal.js'
118+
],
119+
}
120+
```
121+
122+
#### CDN
123+
124+
- **jsDelivr**
125+
126+
```html
127+
<script src="https://cdn.jsdelivr.net/npm/vue-final-modal"></script>
128+
```
129+
130+
- **Unpkg**
131+
132+
```html
133+
<script src="https://unpkg.com/vue-final-modal"></script>
134+
```
135+
136+
### **Add component to template**
85137

86138
```html
87139
<vue-final-modal v-model="showModal">
88140
Modal Content Here
89141
</vue-final-modal>
90142
```
91143

92-
**3. Create a button to toggle the modal.**
144+
### **Create a button**
93145

94146
```html
95147
<button @click="showModal = true">Launch</button>
96148
```
97149

98-
**4. All default props**
150+
### **Default props**
99151

100152
```js
101153
const CLASS_TYPES = [String, Object, Array]
@@ -118,12 +170,29 @@ const CLASS_TYPES = [String, Object, Array]
118170
}
119171
```
120172

121-
**5. Events.**
173+
## **Events**
174+
175+
### `@click-outside`
176+
177+
- Emits while modal container on click.
178+
179+
> If prop `clickToClose` is `false`, the event will still be emitted.
180+
181+
### `@before-open`
182+
183+
- Emits while modal is still invisible, but before transition starting.
184+
185+
### `@opened`
186+
187+
- Emits after modal became visible and transition ended.
188+
189+
### `@before-close`
190+
191+
- Emits before modal is going to be closed.
192+
193+
### `@closed`
122194

123-
- @before-open: Before open
124-
- @opened: When opened
125-
- @before-close: Before close
126-
- @closed: After closed
195+
- Emits right before modal is destroyed.
127196

128197
## Contribution
129198

dist/VueFinalModal.esm.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/VueFinalModal.esm.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/VueFinalModal.umd.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/VueFinalModal.umd.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/components/global/ShowCode.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<details class="pt-4">
2+
<details>
33
<summary class="outline-none">Show code</summary>
44
<slot />
55
</details>

docs/content/en/events.md

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)