Skip to content

Commit 5609f28

Browse files
committed
docs
1 parent 0673385 commit 5609f28

File tree

1 file changed

+39
-3
lines changed

1 file changed

+39
-3
lines changed

README.md

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
A simple and lightweight Vue modal component. For short we call it VM2. (Still experimental)
66

7+
## Demo
8+
[demo codesandbox](https://tautan.link/demoVueModal)
9+
710
## Install
811
```bash
912
yarn add @burhanahmeed/vue-modal-2
@@ -42,10 +45,10 @@ __API usage__
4245
```javascript
4346
methods: {
4447
open () {
45-
this.$vm2.open('model-1')
48+
this.$vm2.open('modal-1')
4649
},
4750
close () {
48-
this.$vm2.close('model-1')
51+
this.$vm2.close('modal-1')
4952
}
5053
}
5154
```
@@ -58,12 +61,27 @@ vue-modal-2 also accept options in `.use()` function as second argument.
5861
- example: `VueModal`
5962
```javascript
6063
Vue.use(Modal. {
61-
componentName: 'VueModal'
64+
componentName: 'MyModal'
6265
});
6366
```
67+
```html
68+
<template>
69+
<my-modal name="modal-1" @on-close="close">
70+
Hello From Inside Modal Component
71+
</my-modal>
72+
</template>
73+
```
74+
6475
### Props
6576
vue-modal-2 accept some props
6677

78+
#### `@on-close` or `v-bind:on-close`
79+
props function using to close the modal (__required__).
80+
- type: `function`
81+
- required: `true`
82+
83+
see example above.
84+
6785
#### `headerOptions`
6886
options props for vue-modal-2 header
6987
- type: `Object`
@@ -81,6 +99,20 @@ options props for vue-modal-2 footer
8199
- type: `Object`
82100
- default: `{}`
83101

102+
__footerOptions key:__
103+
104+
|key|type|default|desc|
105+
|---|---|---|---|
106+
|`footerOptions.justify`|`String`|`flex-end`| determine button position on the left or right|
107+
|`footerOptions.btn1`|`String`|`Button 1`|button one text. Button 1 is the one on the left side.|
108+
|`footerOptions.btn2`|`String`|`Button 2`|button two text. Button 2 is the one on the right side.|
109+
|`footerOptions.btn2`|`String`|`Button 2`|button two text. Button 2 is the one on the right side.|
110+
|`footerOptions.disableBtn2`|`Boolean`|`false`|button 2 (right side) can be disabled.|
111+
|`footerOptions.btn1OnClick`|`Function`|`() => {}`|action when button 1 is clicked.|
112+
|`footerOptions.btn2OnClick`|`Function`|`() => {}`|action when button 2 is clicked.|
113+
|`footerOptions.btn1Style`|`Object`|`{}`|style or css of button 1. eg. `{fontSize: '14px'}`|
114+
|`footerOptions.btn2Style`|`Object`|`{}`|style or css of button 2. eg. `{fontSize: '14px'}`|
115+
84116
#### `noFooter`
85117
used to remove footer
86118
- type: `Boolean`
@@ -115,6 +147,10 @@ text color of modal when mode is light
115147
- default: `black`
116148

117149

150+
## Contribution
151+
Feel free to open an issue or pull request. Open an issue if you want discussing something.
152+
153+
118154
## License
119155

120156
MIT &copy; [burhanahmeed](https://github.com/burhanahmeed/vue-modal-2)

0 commit comments

Comments
 (0)