Skip to content

Commit 87eeda9

Browse files
Component "awes-io/modal-window" was updated to v1.1
1 parent 3f02d6e commit 87eeda9

File tree

1 file changed

+74
-2
lines changed
  • docs/components/modal-window/1.1

1 file changed

+74
-2
lines changed

docs/components/modal-window/1.1/index.md

Lines changed: 74 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ It is a modal window component with a tracked history. Below you will see a visu
1313
import Vue from 'vue'
1414
import VueRouter from 'vue-router' // required
1515
import modalWindow from '@awes-io/modal-window'
16-
import '@awes-io/modal-windwo/dist/main.css' // optionally, for default styling
16+
import '@awes-io/modal-window/dist/main.css' // optionally, for default styling
1717

1818
Vue.use(VueRouter) // required
1919
Vue.use(modalWindow, { /* optional config */}) // registers `<modal-window>` component globally
@@ -55,8 +55,24 @@ include CDN-script, provided by the [platform](//awes.io)
5555
| **theme** | `String` | `'default'` | Styling modal appearance, simply adds additional class to the wrapper, e.g. `is-${theme}` |
5656
| **param** | `String` | `'modal'` | GET-parameter, that recieves a value of **name** param when window is opened. All the modals? by default, share the same GET-param. This means opening next modal closes previouse. |
5757
| **stay** | `Boolean` | `false` | Should the content stay in markup, when window is closed. *Could be configured globally* |
58+
| **bg-сlick-сlose** | `Boolean` | `true` | Should the modal be closed by clicking on background. *Could be configured globally* |
5859
| **lang** | `Object` | [lang](#mw-lang) | Overwrite default lang strings in current modal. *Could be configured globally* |
5960

61+
The properties, marked as **globally configured**, could be provided in `AWES_CONFIG` in camelCase. For example:
62+
63+
```javascript
64+
const AWES_CONFIG = {
65+
66+
// some other config...
67+
68+
modalWindow: {
69+
stay: true,
70+
bgClickClose: false,
71+
// ... other options
72+
}
73+
}
74+
```
75+
6076

6177
### Modal window ID
6278

@@ -187,4 +203,60 @@ Transition styling colud be done with proper [Vue transition component classes](
187203
* modal-transition-awesome-enter-to
188204
* modal-transition-awesome-leave
189205
* modal-transition-awesome-leave-active
190-
* modal-transition-awesome-leave-to
206+
* modal-transition-awesome-leave-to
207+
208+
209+
## AJAX modal example
210+
211+
To show dynamically loading content, place a `&lt;content-wrapper/&gt;` component inside a modal.
212+
213+
> Note, that by default, content will be loaded **each time** modal is opened.
214+
> But if you use modal with `stay` prop turned on - content will be loaded **once**, after the page load
215+
216+
```html
217+
<modal-window name="ajax-example" title="AJAX modal">
218+
219+
<!-- dynamic content -->
220+
<content-wrapper url="https://jsonplaceholder.typicode.com/users">
221+
222+
<!-- loading state stylization -->
223+
<template slot="loading">
224+
<div class="h1 text-center">Loading...</div>
225+
</template>
226+
227+
<!-- content -->
228+
<template slot-scope="ajaxData">
229+
<table-builder :default="ajaxData.data">
230+
<tb-column name="name"></tb-column>
231+
<tb-column name="email">
232+
<template slot-scope="col">
233+
<a :href="`mailto:${col.data.email}`">{{ col.data.email }}</a>
234+
</template>
235+
</tb-column>
236+
</table-builder>
237+
</template><!-- / content -->
238+
239+
</content-wrapper>
240+
</modal-window>
241+
```
242+
243+
<div class="vue-example">
244+
<button class="btn" @click="AWES.emit('modal::ajax-example:open')">AJAX modal</button>
245+
<modal-window name="ajax-example" title="AJAX modal">
246+
<content-wrapper url="https://jsonplaceholder.typicode.com/users">
247+
<template slot="loading">
248+
<div class="h1 text-center">Loading...</div>
249+
</template>
250+
<template slot-scope="ajaxData">
251+
<table-builder :default="ajaxData.data">
252+
<tb-column name="name"></tb-column>
253+
<tb-column name="email">
254+
<template slot-scope="col">
255+
<a :href="`mailto:${col.data.email}`">{{ col.data.email }}</a>
256+
</template>
257+
</tb-column>
258+
</table-builder>
259+
</template>
260+
</content-wrapper>
261+
</modal-window>
262+
</div>

0 commit comments

Comments
 (0)