Skip to content

Commit 1f38815

Browse files
author
Yev
committed
Minor tweaks to documentation site
1 parent 72a15f0 commit 1f38815

File tree

2 files changed

+57
-54
lines changed

2 files changed

+57
-54
lines changed

docs/Intro.md

Lines changed: 51 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
The library supports 2 types of modals - static and dynamic.
44

5-
* **Static** are defined explicitly though the template.
6-
* **Dynamic** are generated based on the configuration passed into the "show modal" function.
5+
- **Static** are defined explicitly though the template.
6+
- **Dynamic** are generated based on the configuration passed into the "show modal" function.
77

88
## Static modals
99

@@ -30,30 +30,29 @@ export default {
3030
mount () {
3131
this.show()
3232
}
33-
}
33+
}
3434
</script>
3535
```
3636

3737
## Dynamic modals
3838

3939
In order to instantiate modals at runtime (for lazy-loading or de-cluttering templates), it is possible to create modals dynamically.
4040

41-
42-
To show dynamic modal you can use the same `$modal.show` function with extended API:
41+
To show dynamic modal you can use the same `$modal.show` function with extended API:
4342

4443
```js
4544
this.$modal.show(
46-
component,
47-
component_properties,
48-
modal_properties,
49-
modal_events
45+
component,
46+
component_properties,
47+
modal_properties,
48+
modal_events
5049
)
5150
```
5251

53-
* `component` - inline or imported Vue component definition
54-
* `component_properties` - any properties that are used within the `component_definition`
55-
* `modal_properties` -modal component properties (see Properties section)
56-
* `modal_events` - modal event handlers (see Events section)
52+
- `component` - inline or imported Vue component definition
53+
- `component_properties` - any properties that are used within the `component_definition`
54+
- `modal_properties` -modal component properties (see Properties section)
55+
- `modal_events` - modal event handlers (see Events section)
5756

5857
Using **imported** component definition:
5958

@@ -63,9 +62,9 @@ import MyComponent from './MyComponent.vue'
6362
...
6463

6564
this.$modal.show(
66-
MyComponent,
67-
{ text: 'This text is passed as a property' },
68-
{ draggable: true }
65+
MyComponent,
66+
{ text: 'This text is passed as a property' },
67+
{ draggable: true }
6968
)
7069
```
7170

@@ -75,18 +74,18 @@ Using **inline** component definition:
7574

7675
```js
7776
this.$modal.show(
78-
{
79-
template: `
80-
<div>
81-
<h1>This is created inline</h1>
82-
<p>{{ text }}</p>
83-
</div>
84-
`,
85-
props: ['text']
86-
},
87-
{ text: 'This text is passed as a property' },
88-
{ height: 'auto' },
89-
{ 'before-close': (event) => {} }
77+
{
78+
template: `
79+
<div>
80+
<h1>This is created inline</h1>
81+
<p>{{ text }}</p>
82+
</div>
83+
`,
84+
props: ['text']
85+
},
86+
{ text: 'This text is passed as a property' },
87+
{ height: 'auto' },
88+
{ 'before-close': event => {} }
9089
)
9190
```
9291

@@ -117,7 +116,6 @@ Vue.use(VModal, {
117116
})
118117
```
119118

120-
121119
## Dialogs
122120

123121
Dialog is a simplified version of the modal which has most parameters set by default and is useful for quick prototyping, alerts, etc. Dialog is merely an example of how easy it is to create modals that fit your project needs. Nevertheless, you can use it if you set `dialog: true` in plugin configuration:
@@ -135,31 +133,30 @@ And include this component in your project:
135133
To show modal follow this example (all params except of “text” are optional):
136134

137135
```js
138-
this.$modal.show('dialog', {
139-
title: 'The standard Lorem Ipsum passage',
140-
text:
141-
'Lorem ipsum dolor sit amet, ...',
142-
buttons: [
143-
{
144-
title: 'Cancel',
145-
handler: () => {
146-
this.$modal.hide('dialog')
147-
}
148-
},
149-
{
150-
title: 'Like',
151-
handler: () => {
152-
alert('Like action')
153-
}
154-
},
155-
{
156-
title: 'Repost',
157-
handler: () => {
158-
alert('Repost action')
159-
}
160-
}
161-
]
162-
})
136+
this.$modal.show('dialog', {
137+
title: 'The standard Lorem Ipsum passage',
138+
text: 'Lorem ipsum dolor sit amet, ...',
139+
buttons: [
140+
{
141+
title: 'Cancel',
142+
handler: () => {
143+
this.$modal.hide('dialog')
144+
}
145+
},
146+
{
147+
title: 'Like',
148+
handler: () => {
149+
alert('Like action')
150+
}
151+
},
152+
{
153+
title: 'Repost',
154+
handler: () => {
155+
alert('Repost action')
156+
}
157+
}
158+
]
159+
})
163160
```
164161

165162
![](https://user-images.githubusercontent.com/1577802/85934434-0dac5300-b8da-11ea-9db5-34fa5a0b7fe0.png)

docs/Usage.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ sidebarDepth: 2
88

99
Configuration options can be passed as a second argument to `Vue.use`.
1010

11+
```js
12+
import VModal from 'vue-js-modal'
13+
14+
Vue.use(VModal, { ... })
15+
```
16+
1117
#### `dialog: Boolean`
1218

1319
Enables [dialogs](Intro#dialogs).

0 commit comments

Comments
 (0)