File tree Expand file tree Collapse file tree 1 file changed +26
-3
lines changed Expand file tree Collapse file tree 1 file changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -17,23 +17,32 @@ $ npm i vuejs-modal -S
17
17
``` javascript
18
18
import Modal from ' vuejs-modal'
19
19
20
+ // If you can use default template, you should be:
21
+ import confirm from ' vuejs-modal/lib/confirm.vue'
22
+
20
23
Vue .use (Modal, {
21
- modals // your modals, is a object
24
+ modals: {
25
+ confirm // default template
26
+ } // your modals, is a object
22
27
})
23
28
```
24
29
25
30
Use in component:
26
31
27
32
``` js
28
33
< template>
29
- ……
34
+ // html
30
35
< / template>
31
36
32
37
< script>
33
38
export default {
34
39
methods: {
35
40
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
+ })
37
46
}
38
47
}
39
48
}
@@ -58,7 +67,21 @@ Vue.use(Modal, {
58
67
59
68
// modal style, the default hava a z-index
60
69
style: {
70
+ position: ' fixed' ,
71
+ top: 0 ,
72
+ left: 0 ,
73
+ bottom: 0 ,
74
+ right: 0 ,
61
75
zIndex: 1000
62
76
}
63
77
})
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 )
64
87
```
You can’t perform that action at this time.
0 commit comments