Skip to content

Commit f128976

Browse files
committed
change readme
1 parent 5c3e989 commit f128976

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

README.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,32 @@ $ npm i vuejs-modal -S
1717
```javascript
1818
import Modal from 'vuejs-modal'
1919

20+
// If you can use default template, you should be:
21+
import confirm from 'vuejs-modal/lib/confirm.vue'
22+
2023
Vue.use(Modal, {
21-
modals //your modals, is a object
24+
modals: {
25+
confirm //default template
26+
} //your modals, is a object
2227
})
2328
```
2429

2530
Use in component:
2631

2732
```js
2833
<template>
29-
……
34+
//html
3035
</template>
3136

3237
<script>
3338
export default {
3439
methods: {
3540
show: function () {
36-
this.$modal.confirm()
41+
this.$modal.confirm().then( res => {
42+
// I click ok button
43+
}).catch( rej => {
44+
// I click cancel button
45+
})
3746
}
3847
}
3948
}
@@ -58,7 +67,21 @@ Vue.use(Modal, {
5867

5968
// modal style, the default hava a z-index
6069
style: {
70+
position: 'fixed',
71+
top: 0,
72+
left: 0,
73+
bottom: 0,
74+
right: 0,
6175
zIndex: 1000
6276
}
6377
})
78+
```
79+
80+
## Event
81+
```js
82+
// If you can click ok button:
83+
this.$emit('$ok', this.$el)
84+
85+
// If you can click cancel button:
86+
this.$emit('$cancel', this.$el)
6487
```

0 commit comments

Comments
 (0)